Add Non DB Entities

Posts   
 
    
jakkamma
User
Posts: 19
Joined: 03-Mar-2005
# Posted on: 25-May-2005 07:24:03   

Hi, I want to save some related entities onto an XML file ( i can use serialisation ) but I also want to insert some related new entities ( which are non existant in DB )

Here is an example ( **bold ** means my custom object related )

Customer customer=LoadCustomer();

foreach( Order order in Customer.Orders) {

  order.deliverDate=Now ;

 // this is not in DB, and I may define a new class or 
  // if there is a way to generate using LLBLGen GUI I can do that ( like customEntity )

**CustomClass myobj=new CustomClass();**

  myobj.SomeProperty = "somevalue" ; 
  myobj.SomeOtherProperty = "someothervalue" ;

  // how can I get order to  have relation to CustomObjects when it is not in DB 
  // and so not automatically generated relationship    
   order.**CustomObjects.Add(myobj);**

}

SaveEntireObjectGraph(customer);

So the resulting XMLFile will have something like this

<xml> <customer id=1> <order id=100 deliverDate="01/01/2005" >

         // the following 2 are the main issues I need solution for
        <customClass>
           < someproperty="somevalue">
           < someotherproperty="someothervalue">
       </customClass>
        <customClass>
           < someproperty="somevalue">
           < someotherproperty="someothervalue">
       </customClass>

</order> </customer> </xml>

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-May-2005 10:25:53   

If you're trying to create entity classes for XML serialization together with existing entity classes, that's not possible.

Frans Bouma | Lead developer LLBLGen Pro
jakkamma
User
Posts: 19
Joined: 03-Mar-2005
# Posted on: 25-May-2005 11:01:57   

Yes in essence. But main difference is I will not try to save the NonDB Entities and for time being I can also live with not saving any objects at all to DB ( just retrieve the DB Entities )

If it is not possible can U think on any other tricky way

For example

If I store some XML Element/Nodes string in a custom attribute of an EntityObject and than XML Serialize the EntityObject ( some thing like that ).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-May-2005 17:52:36   

Hmm. I don't see that's possible. Sure, you can write IEntity(2) implementing classes of course, or your own classes derived from EntityBase(2), and then add them to a collection. simple_smile That's about the options you have.

Frans Bouma | Lead developer LLBLGen Pro