473,756 Members | 4,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Class Loading & System.__COMObj ect

Hi y'all, here's a tricky one:

I've written a wrapper around a Com Interop-generated assembly in C#. It's
called SDEHandler & implements a previously defined interface, so that I can
use it as a provider, and load instances of it dynamically. In other words,
I use it as a "plugin implementation" of a well-known API (a Provider?).

Inside it I create a DataSet, which gets filled with at least a column
containing values of type SDEPoint, a little struct I've written inside the
SDEHandler assembly, that describes a Point with X,Y doubles as fields.

My problem is that after the caller has executed a method resulting in that
DataSet on a dynamically loaded instance of the SDEHandler, the DataSet
seems to contain instead of SDEPoint instances, objects of type
System.__ComObj ect.

Casting that into an SDEPoint fails miserably, kust like my other efforts by
using System.Activato r, ObjectHandle & ObjRef.

Can anyone point out anything that might be causing me all that frustration
???

Some code snippets:

1) The code that creates the SDEHandler instance in the first place:

public IActionHandler GetHandler(Data Source.DataSour ce source){
ActionHandlerDe scriptor descriptor =
(ActionHandlerD escriptor)handl erDescriptors[source.Type];
if(descriptor== null)
throw new ConfigurationEx ception("Unknow n Data Source Type:
"+source.Ty pe);
string strClassName = descriptor.Hand lerClass;
string strAssemblyName = descriptor.Hand lerAssembly;
//Instantiate an ActionHandler for the given data source name ...
try{
ObjectHandle oPntr = Activator.Creat eInstance(strAs semblyName,
strClassName);
return (IActionHandler )oPntr.Unwrap() ;
}catch(Exceptio n e){
throw new InitialisationE xception(e);
}
}
2) the code inside the action handler, that fills the DataSet:
... blah-blah ...
for(int i=0; i<rsCount; i++){
try{
int index = 0;
object[] values = new object[rs.TableDesc.Fi eldCount+1];
// try to get the SHAPE from the recordset ...
try{
Field shape = rs.Fields.Item( "SHAPE");
object val = shape.Value;
Console.Out.Wri teLine("SHAPE is a point? {0}", (val is
MapObjects2.Poi nt));
values[(values.Length-1)] =
Utilities.ToSDE Point((MapObjec ts2.Point)val);
}catch(Exceptio n e){
Console.Out.Wri teLine("Failed to get the SHAPE field: {0}", e.Message);
}
foreach(DataCol umn col in tbl.Columns){
string strColName = col.ColumnName;
Field fld = rs.Fields.Item( strColName);
values[index] = (fld!=null)?fld .Value:null;
index++;
}
tbl.Rows.Add(va lues);
rs.MoveNext();
}catch(Exceptio n e){
Console.WriteLi ne("Exception while parsing rs: {0}", e.Message);
break;
}
}
3) And the code that parses the DataSet & prints out the cols/values ...
public static void PrintDataTable( DataTable dt){
Console.Out.Wri teLine("Printin g Table:"+dt.Tabl eName);
DataColumnColle ction cols = dt.Columns;
foreach(DataRow row in dt.Rows){
for(int i=0; i<cols.Count; i++){
object val = row[i];
Console.Out.Wri teLine("Val is a {0}", val.GetType().T oString());
Console.Out.Wri teLine(cols[i].ColumnName+" = "+row[i]);
}
}
}

... apparently, all my SDEPoint instances have become System.__ComObj ect
instances somehow, that will refuse any type of casting, or simple way of
interrogation about properties

Cheers.
Angel
O:]
Jul 21 '05 #1
0 1876

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

Similar topics

9
4492
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the "Let Users Add Functionality to Your .NET Applications with Macros and Plug-Ins" article at MSDN for the dynamic loading of DLLs http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx
0
312
by: Angelos Karantzalis | last post by:
Hi y'all, here's a tricky one: I've written a wrapper around a Com Interop-generated assembly in C#. It's called SDEHandler & implements a previously defined interface, so that I can use it as a provider, and load instances of it dynamically. In other words, I use it as a "plugin implementation" of a well-known API (a Provider?). Inside it I create a DataSet, which gets filled with at least a column containing values of type SDEPoint,...
2
9161
by: Ron Dahl | last post by:
In Word VBA the expression "ActiveDocument.Paragraphs(1).Style returns "Heading 3" In VB.Net the expression "appWord.ActiveDocument.Paragraphs(1).Style" returns "{System.__ComObject} : {System.__ComObject}" How can I get vb.net to return "Heading 3" instead of "{System.__ComObject} : {System.__ComObject}". Thanks in advance for any help.
0
1549
by: Laurent Lequenne | last post by:
Hello All, I'm currently developing a free windows Scrabble (in french :)) application that uses extensively the WebBrowser class of NET 2.0 for configuration, and data browsing. It works 100% on my machine, with the WebBrowser Class, and the Microsoft.MsHtml component. I can access all elements on the pages through the events, I can change some parts. Everything is rendered with XSLTs and changing directly the document through the msHtml...
15
5682
by: Laurent Lequenne | last post by:
Hello All, I'm currently developing a free windows Scrabble (in french :)) application that uses extensively the WebBrowser class of NET 2.0 for configuration, and data browsing. It works 100% on my machine, with the WebBrowser Class, and the Microsoft.MsHtml component. I can access all elements on the pages through the events, I can change some parts. Everything is rendered with XSLTs and changing directly the document through the ...
1
4110
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem: I dynamically add an htmlcheckbox to a webform in the pages render and set the checked value to true. When the page loads, if I remove the check from the checkbox and then submit it, in the submit event the checkbox' checked value is still...
7
8223
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
2
6542
by: Bigi | last post by:
Hi, Please help, this has been driving me nuts for nearly 2 days now. This vb6 code works: Public oEng As New ebizEngine Public oMsg As ebizMessage Function EbizGetFromQueue() As String
5
2585
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization algorithm to solve a certain messy problem, and many different things. For that I often use several general modules that I have written, like implementation of certain data structures, and small general "utility" functions/classes, plus of course...
0
9275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9846
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.