Retrieving TypedViews from a WebService/WCF supplied DataTable

Posts   
 
    
JSobell
User
Posts: 145
Joined: 07-Jan-2006
# Posted on: 04-Mar-2009 22:29:59   

I started looking into how I might 'cast' or convert a DataTable (that you know came from a specific TypedView) back into an instance of the TypedView without duplicating it. You can do it as follows: MyStuffTypedView tv = new MyStuffTypedView(); DataTable dt = client.GetAnExternalDataTable(); tv.Load(dt.CreateDataReader()); This is obviously cloning the returned one as opposed to 'wrapping' it, but I presume this is the only option as TypedViews inherit from DataTable rather than referencing them.

I'm looking at this as a simple way of returning tables of data from WebService calls. There's not much in the help about TypedViews over WCF/SOAP, so is there a better or 'more correct' way to do this? I know that a DataSet is sometimes not the most efficient data object due to all the metadata included, but the simplicity of having LLBLGen's object wrap it saves FieldsViewsx lines of hand-written code in each project and retains the nice custom additions and properties in the Adapter client code. I suppose we could write a template to generate 'lightweight' objects to pass around for views, but as these would typically be in the same project as our TypedView object it seems a bit pointless simple_smile

Cheers, Jason

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Mar-2009 05:24:40   

Hi Jason, have you tried to set the TypedView2 in the contract and send/receibe it ?

David Elizondo | LLBLGen Support Team