|
No, that's not late-binding. Late binding has to do with how members are resolved and invoked. The actually implementation is uknown at compile time. Script wouldn't exist without late-binding, and it's an important part of COM. A good example in .NET of late-binding is:
public interface IFoo
{
void Test();
}
class Foo1 : IFoo
{
void Test() { Console.WriteLine("from Foo1"); }
}
class Foo2 : IFoo
{
void Test() { Console.WriteLine("from Foo2"); }
}
public class FooFactory
{
public static IFoo CreateFoo(string cls)
{
if (cls == "foo1") return new Foo1();
else if (cls == "foo2") return new Foo2();
else return null;
}
} Callers to FooFactory.CreateFoo get back an IFoo without knowing the implementing type. That's late-binding.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath Stewart wrote:
That's late-binding.
Ok, you win! :p
What I was thinking is called late initialization.....
top secret xacc-ide 0.0.1
|
|
|
|
|
That is entirely possible and was what our flagship product used heavily when I worked for Proplanner before my new job.
The thing is, the request assembly has to be resolvable. Type.GetType will automatically load the assembly if it's not loaded already, but Fusion (the assembly binder) has to be able to find it.
I recommend you read How the Runtime Locates Assemblies[^], as well as Specifying an Assembly's Location[^] in the .NET Framework SDK.
For example, if you wanted to put your plugins in a directory under your app root called Plugins, then in your .config file (named yourapp.exe.config and in the same directory as yourapp.exe) set a probing path like so:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="plugins"/>
</assemblyBinding>
</runtime>
</configuration>
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
... of course another approach is documented in the link I already provided which places a plugin section in the application configuration. Then all that needs to be done is write a hook into the ConfigurationReader that will be called whenever the plugin section of the configuration reader is hit. The format for plugin identification is almost the same as defining a remoting object and we used it for initiating user-written plugins in my web editor our company is using.
This signature left intentionally blank
|
|
|
|
|
There are so many ways to write a plugin host it's not even funny. They're way - which is how I architected it at Proplanner - requires registration (in the .config file, the registry, etc.). The way I mentioned does not. It really just depends on requirements.
So, while I presented a couple different approaches and you presented (a link to) another approach, the fact of the matter is that plugin architectures are numerous.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Thanks a lot Heath for your help and for the links! This is exactly what I needed this time.
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Hi. I need to map items from a DataSet to a SQL table.
The problem is that in the DataSet I can have the same item repeted, but in
the table, I have a field "quantity" to avoid that. So what I need is a
structure where I get each item and the number of repetitions.
In the DataSet, I have one table and I only need to use one column, and the
items are integers, so the idea is passing from:
100 102 100 103 to
100 (2) 102 (1) 103 (1) or something like that.
I don't know if I can get something with the DataSet Select method. I passed
the column to an ArrayList, but I don't know if that simplifyes something.
Can you help me?
Regards,
Diego F.
|
|
|
|
|
Why not do a SELECT with an ORDER BY? That puts the items in numerical order and then it is a matter of counting each one.
This signature left intentionally blank
|
|
|
|
|
Do you mean in the DataSet? Even if I get them ordered, I don't see how can I work with them. Can you please explain a bit more?
Regards,
Diego F.
|
|
|
|
|
The ADO.NET DataSet is a memory-resident representation of data that provides a consistent relational programming model regardless of the source of the data it contains. A DataSet represents a complete set of data including the tables that contain, order, and constrain the data, as well as the relationships between the tables. So if your first load of the dataset is all of the records ordered by the number.
Then you need to enumerate through the dataset counting the number of each type and that becomes another "table" which you add to the dataset which has the format number, count. Then you output the resulting union to the database.
This signature left intentionally blank
|
|
|
|
|
Hi all,
I would like my application to access the Visual Studio .Net Command Prompt so that i can run a command from my application.
I want my application to automatically register a dll by running the regasm command
>regasm Example.dll
What code would i use to do this ?
Thank you ...
|
|
|
|
|
Read on the System.Diagnostics.Process.Start(...) method.
|
|
|
|
|
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "regasm.exe"
p.StartInfo.Arguments = "example.dll"
p.Start();
Something like that should work, or come close.
Custom Software, Custom Solutions. Yye Software.
http://www.yyesoftware.com
|
|
|
|
|
hi,
I want to show the All Databases Names in the specific SQL Server using combo box.
How do I do that one ...
if anyone know about that,please help me.
|
|
|
|
|
|
Connect to the master database and perform the query
SELECT name from sysdatabases This will give you a list of all the databases on the server.
[EDIT]
I should have read more clearly - you just wanted the database names. Ignore the remainder of this post if all you want is the database names. If you want the table names as well then read on....
[/EDIT]
Then, loop around each of the databases performing the following query
SELECT user_name(uid) AS username, sysobjects.name AS tablename
FROM sysobjects
WHERE xtype='U' OR xtype='S'
xtype='U' is for User tables
xtype='S' is for System tables
From all of this you can get a list of all the tables in all the databases on your server.
Remember, user_name could be important as it is possible to have two tables in one database with exactly the same name, but with different user names. You would use the fully qualified table name to access it. e.g.
theServer.theUser.theTable
Does this help?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
I think you will find the INFORMATION_SCHEMA views to be the most usefull. They are supposed to remain unchanged between versions.
SELECT *
FROM INFORMATION_SCHEMA.SCHEMATA
|
|
|
|
|
hi,
yes ,we can get databases Name from above query in local SQL server.But How do we collect databases Names in other SQL Servers...Suppose that another SQL Server is in my Network.I want to get databases Names from that...So How do I collect databases Names from Various SQL Servers in other machines.?
Thanks...
|
|
|
|
|
I guess I don't know what your asking because the only response I can give is:
Run the query on the other servers....
I sense that is not the answer you are looking for.
|
|
|
|
|
I have added 3 tab pages to a form. On each tab page the same user control has been added. On the control there is a left docked treeview and a right docked text boxes. I have added a splitter between these controls so that I'm able to change the size of the treeview. Once I change the size of the treeview in one tab the splitter should be located accordingly in the other tab pages as well so that I don't need to resize it. How can I achieve this?
samitha
|
|
|
|
|
Hi Smitha,
Problem lies in the layout of the userControl
In your case the constituent control s of the userControl should be put in the following sequence:
Step1.Put treeView control on the userControl , with Dock as Left
step2.Put splitter control, with Dock as Left
Step3.Put a panel on the userControl , with Dock as Fill
Step4.put all the textBoxes of the userControl in the above mentioned panel .
This should solve your problem.
Do revert back whether you could solve the problem or not?
(Note: Please delete all the constituent controls from your UserControl and start from Step1)
Regards,
Jay
|
|
|
|
|
Jay_sh_s wrote:
(Note: Please delete all the constituent controls from your UserControl and start from Step1)
That's not necessary and would be a waste of time, especially if lots of code was already written. You'd have to reset all the properties and hook the event handlers back up.
See my reply for how to fix this without removing all your controls and starting over with a fresh layout.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Dear Heath,
Thanks a lot for the added informations. Though I was knowing it roughly but had never tried. Now onwards, I will do exactly what you have suggested.
Regards,
Jay.
|
|
|
|
|
What Jay said is partly right, but don't delete all your controls! Whatever the designer does is also manually possible. Remember that most design-time serialization is your actual source code file.
You need to set the TabIndex of each control accordingly. So, the order that Jay was talking about is the order you should use for your TabIndex s for each Control .
Then, in Controls.AddRange (the method to add controls to a parent control that you'll see in your source code), add the controls in the reverse order you did above. Internally, AddRange iterates through the control array in reverse. You could also just use Controls.Add - in which case you add the controls in the TabStop order - but you could potentially break the designer (behavior varies; it really likes using AddRange ).
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath Wrote:-
You could also just use Controls.Add - in which case you add the controls in the TabStop order -
1.It should be TabIndex order...NOTTabStop order...am I right? seems to be typing mistake on your part.
2.I just tried it, actually it is adding in reverse order, not in the tabIndex order. like below:
this.treeView1.TabIndex = 0;
this.splitter1.TabIndex = 1;
this.panel1.TabIndex = 2;
this.Controls.Add(this.panel1);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.treeView1);
Please clearify.
Regards,
Jay.
|
|
|
|