How can I create a common ancesstor?

Posts   
 
    
Acad
User
Posts: 6
Joined: 19-Jun-2009
# Posted on: 07-Jul-2009 22:34:03   

I've been playing with LLBLGen pro for a few weeks now...

trying to create a ISynchronizable interface which most (but not all) objects will implement... Basically, the interface describes a Guid property that is used for synchronization between a office application and our website.

Essentially, all of the website's objects primary keys are Guids and I would like to easily synchronize those objects between 2 different systems.

All of my LLBLGen entities have this Guid property, but I am unable to define a good common ancestor/subclass to which they all inherit from.

For instance I have Orders, Products, Product Attributes, etc... all of with have this Guid defined but I can't figure out how to get them to all use the same subclass without lots of manual alterations every time the project is generated.

Am I missing something really simple? Is there an easy way to get 80% of the object to inherit from "SyncableEntityBase" instead of "CommonEntityBase"?

Thanks!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-Jul-2009 05:24:26   

Does the AdditionalInterfaces region_code help you here? You then could put this on the affected entities. You also could do this at Designer, in the Code generation options tab.

If you want to change the CommonEntityBase to SyncableEntityBase, that is not built in. To do that, you must modify a bit the templates and create a custom property to set in the entities (at designer) to know what entities should inherit from your class.

David Elizondo | LLBLGen Support Team
Acad
User
Posts: 6
Joined: 19-Jun-2009
# Posted on: 30-Jul-2009 11:27:31   

Thanks for the help Daelmo... I figured this out by playing around with the templates.

If a certain field exists in the entity, change the base class from CommonEntityBase to SyncableEntityBase and I just create a bunch of partial classes to implement the abstract properties/methods. I'm sure there's probably a better way but I'm happy with this solution allows me to have a common ancestor for certain classes.

Thanks again.