Share an instance of a collection

Posts   
 
    
ericdes
User
Posts: 19
Joined: 09-Aug-2008
# Posted on: 25-Aug-2008 16:05:26   

What's the equivalent of adding a .xsd file that contains a shared dataset for a collection generated by llblgen pro?

I would like to create a file with an instance of a collection that I would share among several winforms (possibly available at design time). I use VS 2008.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Aug-2008 08:39:29   

I don't know if I understand 100% your need disappointed Why don't share the entitycollection through a class, or pass it to the winforms constructors? Anyway, you could use XML serialization-deserialization and write the serialized collection to a file, then load and deserialize it simple_smile

David Elizondo | LLBLGen Support Team
ericdes
User
Posts: 19
Joined: 09-Aug-2008
# Posted on: 28-Aug-2008 11:01:34   

The solution I'm using now is to pass the entity collections to the winform constructors, however it doesn't allow me to use the design time features. I have to place another instance of the entity collection on the new form for that purpose, for which I don't have any other use.

I thought of writing a class which I would share, but how would it be available at design time?

Sharing datasets accros winforms is pretty straighforward, I got used to that! Now that i'm using LLBLGEN Pro, I was just wondering if there was anything just as easy as a shared .xsd file to use. I think the serialization-deserialization is too much of an overhead just for that purpose.

Thank you.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 28-Aug-2008 15:55:28   

In each Form you may just use the available EntityCollection in the toolbox at Design time. Then at runtime/code you should pass the shared instance of the entityCollection to the CTor of each form, where you set the Form's entityCollection property (the one used at design time), to the passed in instance.

ericdes
User
Posts: 19
Joined: 09-Aug-2008
# Posted on: 28-Aug-2008 16:27:26   

Yes, it looks like it the best option for me.

Thank you.