473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Com connection

Hi,
Can any one tell me what`s the diffrent bettwin the two configuration to
expose a C# class to a com object:

[Guid("B6F829AA-D1D0-4f14-9B3E-D8D4FA033819")]

public class ConfigurationBuilder : IConfigurationBuilder

{...}

[ClassInterface(ClassInterfaceType.None)]

public class ConfigurationBuilder : IConfigurationBuilder

{...}

when should i use GUID and when should i use the ClassInterfaceType
attribute and whate the comoiler do with this attribute?

Thanks.
Nov 15 '05 #1
3 1280
Dave,

You should actually be using BOTH of these attributes, as they both do
different things. The Guid attribute on the class is going to declare what
the CLSID of the COM component will be. The ClassInterface attribute will
indicate that the class will not export an interface of its own. They
should both be on there.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"dave" <Da************@verint.com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
Hi,
Can any one tell me what`s the diffrent bettwin the two configuration to
expose a C# class to a com object:

[Guid("B6F829AA-D1D0-4f14-9B3E-D8D4FA033819")]

public class ConfigurationBuilder : IConfigurationBuilder

{...}

[ClassInterface(ClassInterfaceType.None)]

public class ConfigurationBuilder : IConfigurationBuilder

{...}

when should i use GUID and when should i use the ClassInterfaceType
attribute and whate the comoiler do with this attribute?

Thanks.

Nov 15 '05 #2
And what is the advantage of declaring a CLSID vs. letting the VS create
one?

Do we need a different CLSID for every class, or only one for the dll?

Francis

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eO**************@tk2msftngp13.phx.gbl...
Dave,

You should actually be using BOTH of these attributes, as they both do
different things. The Guid attribute on the class is going to declare what the CLSID of the COM component will be. The ClassInterface attribute will
indicate that the class will not export an interface of its own. They
should both be on there.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

Nov 15 '05 #3
Francis,

When you let .NET create the CLSID, it will create a new one every time
you build the application. This can get quite messy, and locating the
registry entries (if you have to) can be a pain.

You will need to create one for every class that you plan on exporting
to COM, as well as every interface you want to export to COM.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Francis Gingras" <pr*****@nowhere.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
And what is the advantage of declaring a CLSID vs. letting the VS create
one?

Do we need a different CLSID for every class, or only one for the dll?

Francis

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:eO**************@tk2msftngp13.phx.gbl...
Dave,

You should actually be using BOTH of these attributes, as they both do different things. The Guid attribute on the class is going to declare

what
the CLSID of the COM component will be. The ClassInterface attribute will indicate that the class will not export an interface of its own. They
should both be on there.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: G-Fit | last post by:
Hello group, I have several servers hosting SQL databases. On each of them, I have several databases. All those databases have the same structure (even those on different servers), only the data...
11
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
6
by: Chris Szabo | last post by:
I've created a data access layer for a .NET web application. I'm using C# and framework 1.1. I'm getting an error from time to time when I close a connection saying: ...
18
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection...
35
by: Eric Sabine | last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET connection object, SQLConnection to be exact) and then I came across the following in some microsoft code. If Not cn Is Nothing...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
3
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
0
by: Robert Avery | last post by:
In VBA/VB6, I had a class (incomplete sample below) that watched and displayed for the user all connection events, so that I could easily see what SQL was taking a long time, and when it freezes, I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.