|
Considering:
0) We have pretty much determined that what you were originally asking about is currently impossible.
1) You need to enumerate the types in the loaded assemblies (and/or develop an all-out plug-in system).
I question whether or not the static instances and Initialize methods are required at this point -- I think that they were simply failed attempts at trying to get it work the way you thought it might.
Certainly, the way I'm doing it doesn't use either.
Aren't your static instances merely duplicates of what's in the Dictionary?
And is there any code in the Initialize methods?
Can you remove them without harming the process? (Perhaps alter your Attribute to refer to something else?)
(I'm also not so thrilled about the Attribute.)
|
|
|
|
|
PIEBALDconsult wrote: Aren't your static instances merely duplicates of what's in the Dictionary?
Undoubtedly.
PIEBALDconsult wrote: And is there any code in the Initialize methods?
Nope.
Can you remove them without harming the process? (Perhaps alter your Attribute to refer to something else?)
(I'm also not so thrilled about the Attribute.)
Afraid not.
To be more clear:
Actually the static instances are the primary method of accessing the data in most (99%) cases , this look-up-by-name feature is only needed for a small sub-set of clients. The problem being that when the clients do look-up-by-name there was no guarantee that the class had ever been accessed, and the static instances initialized. The dictionary serves two roles, first as the look-up-by-name feature and second maintaining uniqueness in the names (this is very important in the actually application).
|
|
|
|
|
If you're not usually looking them up by name, then why require that the names be unique?
I recommend having the lookup as the normal/only access method.
But I suppose it may be too late.
|
|
|
|
|
Hi there,
I'm currently trying to serialize a wsdl.exe generated object
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://myNamespace/")]
public partial class marketDataEventV1 {
using the following lines of code:
marketDataEventV1 mdEvent = CreateMarketDataEventV1();
XmlSerializer ser = new XmlSerializer(typeof(marketDataEventV1));
StringBuilder sb = new StringBuilder();
ser.Serialize(new StringWriter(sb), mdEvent);
Now, having a look to sb.ToString() shows, that the result (string) does not contain the namespace declaration.
I wonder now, how to get the serializer taking account for the namespace?!
Thanks in advance!
|
|
|
|
|
Take a look at this[^]
Use the XmlSerializerNamespaces to add your namespace and pass it to the ser.Serialize overload method.
Tarakeshwar Reddy
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Thanks, I've already noticed XmlSerializerNamespaces , but this way, I need to code which namespace belongs to which object. But that's exactly what the [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://myNamespace/")] -attribute says.
So how to tell the serializer to have a look for these attributes? I expected that as a default..
|
|
|
|
|
May be XmlRootAttribute[^] is what you need to use.
Tarakeshwar Reddy
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
That works, thank you.
However, I did not expect to need to change the generated code.
|
|
|
|
|
|
Did you make sure you have access to the machines you're trying to connect to - does the user which runs your app exist on the remote machine with the same password?
If not, then I too get the "Could not connect to Remote Computer" message. Otherwise it works just fine.
|
|
|
|
|
Hi,
Thanks for the reply.
please look at the code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Diagnostics;
using System.ServiceProcess;
using System.IO;
using System.Collections;
namespace ListNetworkComputers
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void frmMain_Load(object sender, EventArgs e)
{
try
{
NetworkBrowser nb = new NetworkBrowser();
foreach (string pc in nb.getNetworkComputers())
{
cmbNetworkComputers.Items.Add(pc);
}
}
catch (Exception ex)
{
throw ex;
}
}
private void cmbNetworkComputers_SelectedIndexChanged(object sender, EventArgs e)
{
string nm = cmbNetworkComputers.Text.ToString();
IPHostEntry ip = Dns.GetHostEntry(nm);
string hostip = ip.AddressList[0].ToString();
Process[] ipByName = Process.GetProcesses(nm);
foreach (Process p in ipByName)
{
cmbIPList.Items.Add(p.ProcessName.ToString());
}
}
}
}
as i am not able to attach my project here so I am getting error at Process[] ipByName = Process.GetProcesses(nm);
My application is present On Server and remaining are clients.
So i want to get all the processes of clients
Thanks
Ajay Kulkarni.
|
|
|
|
|
Did you actually read Callas' response?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Guess not, but then again I didn't "supply codez.."
|
|
|
|
|
Now please stop removing your messages when solved, it is against the forum guide lines, as it results in unreadable threads. See here[^].
|
|
|
|
|
Have you tried to disable any firewalls that may be running on the client computers?
People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs
|
|
|
|
|
Hi,
I'm facing a problem to fetch data rows from a child table using data set and xml file ,
using VS2005 and created the data set and tables using the wizard.
Please consider the following scenario:
TABLE1 - InstalledProgramInfo
- Name [string , Key]
- UninstallSequenceNumber [int]
TABLE2 - AdditionalBackupInfo
- Name [string , Key]
- Source [string , Key]
- Destination [string , Key]
Relation - InstalledProgramInfo_AdditionalBackupInfo (Name -> Name) , Relation type (one to many).
The XML file content is as follow:
<InstalledProgramInfo>
<Name>AAA<</Name>
<UninstallSequenceNumber>0</UninstallSequenceNumber>
<AdditionalBackupInfo>
<Name>AAA</Name>
<Source>C:\SourceTest</Source>
<Destination>C:\DestTest</Destination>
</AdditionalBackupInfo>
<AdditionalBackupInfo>
<Name>AAA</Name>
<Source>C:\SourceTest1</Source>
<Destination>C:\DestTest1</Destination>
</AdditionalBackupInfo>
</InstalledProgramInfo>
The code is as follow (The name of the data set is AppConfigurationDataSet):
AppConfigurationDataSet DataSet = new AppConfigurationDataSet();
DataSet.ReadXml("AppConfiguration.xml");
InstalledProgramInfoDataTable Table = (InstalledProgramInfoDataTable)DataSet.Tables["InstalledProgramInfo"];
foreach(InstalledProgramInfoDataRow CurrentRow in Table.Rows)
{
foreach(DataRow NestedRow in CurrentRow.GetChildRows("InstalledProgramInfo_AdditionalBackupInfo"))
{
DoSomething();
}
}
Anyone?
With best regards,
Eli
|
|
|
|
|
Good morning everybody,
I develop a csharp smart device application.I tried to connect my forms to a local database that i was created.Going to Data->add new data source,i see that my database is connectionstring is like that:
Data Source=.\BaseGmaoLocale.sdf;
When I try to connect to it with my code:
string chcc = @"Data Source=.\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(chcc);
Always when running,it generates an error telling me that it can't found the path to my database.
I used this link:
http://www.connectionstrings.com/sql-server-2005-ce[^]
I tried with the full name of the database but still the same error:
string chcc = @"Data Source = C:\\Users\\Admin\\Documents\\Visual Studio 2008\\Projects\\GMAOMobile\\ModeDifféré\\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(chcc);
Thank you a lot for all u suggestions
|
|
|
|
|
Are you deploying the database on the device? (I'd be amazed that it would be at C:\\Users\\Admin\\Documents\\Visual Studio 2008\\Projects\\GMAOMobile\\ModeDifféré\\BaseGmaoLocale.sdf on your device
|
|
|
|
|
Hi,
No i tried the application with the emulator.
regards
|
|
|
|
|
Well have you deployed it on the emulator then? The emulator does not have access to your local file system. You should copy the database to the device, whether it is an emulator or a real device. I forget how it's done, but you should include your DB file in your project, select properties, and choose some like 'deploy' in the file properties.
|
|
|
|
|
Hi,
As I read,I go to the emulator's file menu->configure.. I added the shared file:\\Admin-PC\GMAOMobile
I added the path in my code as i found in the data->add data source
string chcc = @"Data Source=.\BaseGmaoLocale.sdf";
SqlCeConnection sqlceconn = new SqlCeConnection(chcc);
But still not working
I feel really crazy about this error
any help
regards
|
|
|
|
|
You really have to copy the file to the emulator, not share the file with the emulator. Since your path indicates that it is in the current directory, copy it to the directory where your program resides.
The emulator also doesn't come with SQLCE, you will have to deploy it also, but I suppose the IDE does this for you ( you do have a reference to System.Data.SQLServerCe, do you?)
Have a llok at this tutorial: http://dotnetperls.com/sqlce-database-use[^]
|
|
|
|
|
Hi,
I tried with the physical path of my database
string chcc = @"Data Source = C:\\Users\\Admin\\Documents\\Visual Studio 2008\\Projects\\GMAOMobile\\ModeDifféré\\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(chcc);
but not still not working.
Concerning u note,I don't understand what u mean by:
The emulator also doesn't come with SQLCE, you will have to deploy it also,
For the reference,I have the reference System.Data.SQLServerCe
Thanks for u help
|
|
|
|
|
Yes that's the physical path on your PC, but the program will not run on your PC, will it?
The Emulator, or your smart device comes empty: it does not have the .net framework, it does not have SQL CE, it has just the OS, and some manufacturer or Microsoft supplied programs. .Net and SQLCE come in .cab files, supplied by Microsoft. When you copy your program to the emulator or to the the phone, Visual studio creates a deployment package that contains all these files(choosing the right ones for the processor type of your device), and copies this deployment package to the device. The emulator or the smart device will not have access to any files on your pc. So if your database file is stored somewhere on your PC, the emulator will not be able to reach it;
The database file probably does not exist on your PC either, except if you have created it using SQL CE for PC; The only thing that exists is an empty sdf file in the development environment. You've probably created the data connection in the ide, and it's now sitting in the 'server explorer' pane (the left pane in visual studio). Now add this data connection to your project (probably the right pane).
From then on, everything should be automatic. Visual studio will build the packages, select the cab files, copy them to your device, start the remote debugger....
Now, You've probably messed around so long with your project that a lot of the settings are messed up.
Start afresh, create a new project, a new database, and don't use any of the settings from the other project. Follow the tutorial exactly, and try to understand what is happening at each step. Once you have the tutorial running, create another new project, and this time use your specifications and your requirement. Test each step along the way, and if something does not work, check what you have done differently from the tutorial.
|
|
|
|
|
Hi,
Thanks a lot for u explanation.I vote for it.I follow u steps and the link bellow:http://msdn.microsoft.com/en-us/library/aa289160%28VS.71%29.aspx#grfvsdcopyingfilestotheemulator[^]
But still the same problem.I am fed up really of this exception.
I want to mention that when going to visual studio:menu tools->connect to device->connect and then to start->Progams->File explorer I found in the storage card my shared file \\Admin-PC\GMAOMobile.Can I use the storage card option to connect to my database??
thanks
|
|
|
|