Guid attributes

  • Thread starter Thread starter Robert Scheer
  • Start date Start date
R

Robert Scheer

Hi.

I was told that it is a good practice to define a Guid attribute for
all the classes I intend to use in COM+, but I could not find a good
explanation for it, since I think that .NET generates one for me. Is
there really any benefits when using the Guid attribute in all my
serviced components? I don't know if it is relevant, but all my
clients are managed clients.

Thanks,

Robert Scheer
 
Hi Rob

Yes, there is a good reason for defining a guid using attributes
You are spot on when you say that C# gives you one when you compile (if you have marked the project for com interop), but the problem is that the compiler will give you a new guid every time you compile.

Further to this, you should really make sure that you apply the GUID attribute to the whole assembly, to every class/interface and also assing DISPID attributes to all the methods/properties on your classes and interfaces too. This will ensure that any programs that already rely on you COM/COM+ component will always be able to access you component

I hope this helps a little bi

Cheer

Eddie de Bear
 
Back
Top