Typed Lists over COM-interop

Posts   
 
    
Rene
User
Posts: 54
Joined: 20-Jun-2006
# Posted on: 11-Aug-2006 23:44:12   

Hi,

I'm working on a project, where LLBLGen (1.0.2005.1) is implemented to replace inline-SQL. The application is partly VB6 and partly C# (VS 2005 and .NET 2.0). We use the Webservice-templates to generate Proxy-classes for the generated code from LLBLGen. For use in VB6 we create COM-wrappers for the Proxy-classes, using RegAsm /tlb. This all works fine for normal Entities. For Typed Lists the COM-wrappers were also looking fine. But if I call a webmethod, which returns a Typed List and sets an instance of the Typed List I get this exception from the COM-interop-subsystem:

This type has a ComVisible(false) parent in its hierarchy, therefore QueryInterface calls for IDispatch or class interfaces are disallowed.

I think this is because the Rows of an Typed List inherrit from System.Data.DataRow. And that class is not compiled with ComVisible(true).

I already have a work-around for this, which converts the typed-list to a generic DataSet. But I would like to have a strongly-typed-list.

Does anyone have a suggestion? Thanks! René

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 12-Aug-2006 11:09:59   

Could you try for me if adding the ComVisible(true) attribute to the generated typedlist row class solves the problem? If so I'll add the attribute to the generated code.

Frans Bouma | Lead developer LLBLGen Pro
Rene
User
Posts: 54
Joined: 20-Jun-2006
# Posted on: 12-Aug-2006 20:07:57   

I added the attibute to AssemblyInfo.cs. That means the attribute is used on all generated classes. This works for the Entities. The attribute is also set for the Typed List Row classes. But the Typed List Row classes inherrit from System.Data.DataRow, which is not compiled with that attribute. And I think that's the reason why this exception is thrown.

So it is not necessary to add the attribute to the classes, because once it is added to AssemblyInfo.cs, the code generator will leave the attribute there. The problem is that I can't add the attribute to System.Data.DataRow. And that is necessary in order to make the Typed List Row ComVisible. I'm not sure if there is any possibility to make this working, because it looks to me that all the parent classes need to be ComVisible. Maybe there is a possibility to generate Typed List Row classes which do not inherrit from a class in System.Data?

René

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 14-Aug-2006 08:18:14   

I think TypedLists (dataTables) should be wrapped in DataSets for such scenarios.

Rene
User
Posts: 54
Joined: 20-Jun-2006
# Posted on: 14-Aug-2006 10:11:27   

I have it converted to a DataSet now. And that's a working solution. But I would prefer a strongly-typed-class if that is possible somehow.

Thanks, René

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 14-Aug-2006 11:12:44   

How can a dataset work and a class derived frm a datatable not work at all? confused That's pretty strange, considering a dataset also has to be marshalled to COM and it contains datatables with datarows...

Frans Bouma | Lead developer LLBLGen Pro