finally{}
My interactions with .Net and Web development - What's most important is what happens finally{}
Blog Stats
Posts - 42
Articles - 0
Comments - 98
Trackbacks - 34
Home
Archives
Contact
Login
<< Interface from a different assembly
|
Home
|
strObject1.Equals(strObject2) v/s strObject1 == strObject2 >>
Dynamically loading a C# serviced component
Type type = Type.GetTypeFromProgID( "ComponentName.1", "localhost", true );
// or, using a guid....
//Type type = Type.GetTypeFromCLSID( new Guid( "{AA77B197- A85D-445E-88C9-2A564D756220}" ), "remoteserver", false );
m_Component = (IMyInterface) Activator.CreateInstance( type );
// IMyInterface is the interface that is extended by the serviced component on the server side.
//Now call any method on the component.
m_Component.ComponentsMethod();
Share This Post:
Print
posted @ Tuesday, September 20, 2005 4:26 PM
Feedback
#
re: Dynamically loading a C# serviced component
Sometimes I want to do this when the assembly for the serviced component is not present in the GAC or locally, so the type cannot be loaded. And why should it have to be, when all you need is the interface? Then the trick is to do this:
m_Component = (IMyInterface) Marshal.BindToMoniker("new:ComponentName.1");
9/20/2005 7:35 PM |
Luke
#
re: Dynamically loading a C# serviced component
Thanks for the info. But then, if its not in GAC, neither locally, then where is the assembly located in your scenario? and what about the "new:" new and colon thing that you've specified?
Could you please clarify more.
Thanks,
Vinayak
9/21/2005 7:40 AM |
Vinayak
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
Enter the code shown above
Remember Me?
News
I am currently working on....
C#
XML
XSLT
Javascript, DHTML
VSIP- Visual Studio Extensibility
Winforms
ASP.Net 2.0
Web Services
with Microsoft .Net 2.0
Recent Comments
good article
by JITU
Thanks. I was really stuck on that one. Just put...
by Matthew Theroux
really helpful.
by iSat
thanks, it was very helpfull
by dolev
I use sonething like preparedStatement.setBytes(2,...
by John Wong
Archives
May, 2006 (1)
March, 2006 (2)
February, 2006 (3)
January, 2006 (5)
November, 2005 (1)
October, 2005 (2)
September, 2005 (4)
August, 2005 (3)
July, 2005 (1)
June, 2005 (1)
December, 2004 (3)
November, 2004 (8)
October, 2004 (1)
September, 2004 (5)
August, 2004 (2)
Post Categories
XSLT
DBMS
.Net Framework
Web Services
C#
ASP.Net
Web
General
SQL Server/Database
Image Galleries
Vimage
Blogroll
Adam Bosworth
Aspects of AJAX
BradAdams
Chris Lyon
Craig Skibo
David Ing's blog
dotnetindia
Gaurav Khanna
IT Digest - TPatel
Joel on Software
Martin Fowler's bliki
Mehnaz Singh
Scobleizer
ScottGu's Blog
Sells Brothers
dotNet
.NetBookClub
XSLT
XSLT mailing list
Syndication:
RSS
ATOM
Hosted by
Copyright © Vinayak