|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using ADO.NET DataSet in Unmanaged C++ COM CodeHello,
I am accessing the database using ADO.NET/Managed C++. I would like to use the returned data in form of cursors in Unmanaged C++ (standard C++ with COM). Through COM Callable Wrappers & Interop the Stored Procs will be called. The in-out data volume handled through this module will be large, so the high performance is required. Is there any standard way to write marshaling to use ADO.NET DataSets in COM/C++ world? How to leverage XML? Thanks. -AJ AJ,
Why don't you just use DataReaders for this? - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quoteHide quote "AJ" <A*@discussions.microsoft.com> wrote in message news:0E3080BA-C2EC-4797-BEC3-8A684256BF26@microsoft.com... > Hello, > > I am accessing the database using ADO.NET/Managed C++. I would like to use > the returned data in form of cursors in Unmanaged C++ (standard C++ with > COM). Through COM Callable Wrappers & Interop the Stored Procs will be > called. The in-out data volume handled through this module will be large, > so > the high performance is required. > > Is there any standard way to write marshaling to use ADO.NET DataSets in > COM/C++ world? How to leverage XML? > > Thanks. > -AJ Thanks Sahil,
Yes, I am using SqlDataReader and XmlReader in Data Tier which is in .NET. As some of the Business Tier is in Standard C++ and COM, I was looking for consuming the ADO.NET DataSets or XML in Unmanaged C++. The COM Callable Wrapper returns pointer to IUnknown, which needs marshaling. To communicate with Data Tier in .NET from Business Tier in Win32 there might be some standard way. That is what I was looking for. As there is lot of server side data processing, I was exploring efficient way to get and put large data from Business Tier into database through Data Tier. The database calls are using Stored Procs. Data Tier will be in Managed C++ with ADO.NET. -AJ Show quoteHide quote "Sahil Malik" wrote: > AJ, > > Why don't you just use DataReaders for this? > > - Sahil Malik > http://dotnetjunkies.com/weblog/sahilmalik > > > "AJ" <A*@discussions.microsoft.com> wrote in message > news:0E3080BA-C2EC-4797-BEC3-8A684256BF26@microsoft.com... > > Hello, > > > > I am accessing the database using ADO.NET/Managed C++. I would like to use > > the returned data in form of cursors in Unmanaged C++ (standard C++ with > > COM). Through COM Callable Wrappers & Interop the Stored Procs will be > > called. The in-out data volume handled through this module will be large, > > so > > the high performance is required. > > > > Is there any standard way to write marshaling to use ADO.NET DataSets in > > COM/C++ world? How to leverage XML? > > > > Thanks. > > -AJ > > > Hey AJ,
First of all, there isn't enough benefit in my eyes in subjecting yourself to C++ if you are dealing with pure managed code. (Your data tier). Secondly, DataReader is connected .. sure .. but can be easily made disconnected (search my blog for "How to create a databindable data reader"). BTW, that is also the mostest efficientest way atleast AFAIK to get disconnected data from the d/b. The only more efficient and pure .NET way is to use a connected datareader. And in multi user scenarioes that just might not be very efficient (since it'd have the tendency to block open connections for a longer period). Finally, a huge object such a dataset might have one odd thing in it that is set to ComVisible(False). in other words, I am a bit leery about exposing a huge object as a dataset via interop to a COM thing. It is certainly possible, but you might run into practical problems that any amount of theory (typically books) won't apprise you of. Most books touch the most simplistic approach and leave it there. I personally would be more comfortable with creating your own business objects, populating them in the managed business layer using the dataset received from the data layer, and sending that to C++/COM libraries that you might already have. Call me a pessimist, but when it comes to dealing with COM/.NET Interop, I am much more comfortable in dealing with objects that I have full control over. I've had plenty of unexplained problems there :-/ . like Method "~" of object "~" failed .. (How do you decipher that .. especially if it were coming from deep within the very complicated RCW for the dataset). Also, how ..NET objects are exposed to COM via interop, how it has to go thru mscoree.dll, which shims a COM component and finds the dll for you, it isn't the simple RegSvr32 registration, in other words, it is so not a COM component anymore .. that I'd much rather stick with simpler objects going over that layer. .. oh and not to mention garbage collection for COM/.NET mixture .. .. enough reasons already :) So my recommended solution is Database <--> C# .NET DataLayer <-(dataset or something else) -> Business Layer --> UltraDumbAndSimpleAndFullySerializableBizObject <---interop--> Win32. - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quoteHide quote "AJ" <A*@discussions.microsoft.com> wrote in message news:FDE76E50-F963-4897-A112-B0DF600A7CBD@microsoft.com... > Thanks Sahil, > > Yes, I am using SqlDataReader and XmlReader in Data Tier which is in .NET. > As some of the Business Tier is in Standard C++ and COM, I was looking for > consuming the ADO.NET DataSets or XML in Unmanaged C++. The COM Callable > Wrapper returns pointer to IUnknown, which needs marshaling. To > communicate > with Data Tier in .NET from Business Tier in Win32 there might be some > standard way. That is what I was looking for. > > As there is lot of server side data processing, I was exploring efficient > way to get and put large data from Business Tier into database through > Data > Tier. The database calls are using Stored Procs. Data Tier will be in > Managed > C++ with ADO.NET. > > -AJ > > > > "Sahil Malik" wrote: > >> AJ, >> >> Why don't you just use DataReaders for this? >> >> - Sahil Malik >> http://dotnetjunkies.com/weblog/sahilmalik >> >> >> "AJ" <A*@discussions.microsoft.com> wrote in message >> news:0E3080BA-C2EC-4797-BEC3-8A684256BF26@microsoft.com... >> > Hello, >> > >> > I am accessing the database using ADO.NET/Managed C++. I would like to >> > use >> > the returned data in form of cursors in Unmanaged C++ (standard C++ >> > with >> > COM). Through COM Callable Wrappers & Interop the Stored Procs will be >> > called. The in-out data volume handled through this module will be >> > large, >> > so >> > the high performance is required. >> > >> > Is there any standard way to write marshaling to use ADO.NET DataSets >> > in >> > COM/C++ world? How to leverage XML? >> > >> > Thanks. >> > -AJ >> >> >>
Other interesting topics
ObjectSpaces, object persistence
Table relations across datasets Is Whidbey the beginning of the end for the developer ? I want help with the jet 4.0 provider.. Cann't get my only record with OracleDatareader object DataAdapter call ExecuteReader instead of ExecuteNonQuery Add Connection to ADO Database Returning error from stored proc ADO and ADO.net in the same transaction where can I download the ADO.Net object? |
|||||||||||||||||||||||