StrataFrame Forum

BO inheritance

http://forum.strataframe.net/Topic13311.aspx

By George Nentidis - 1/8/2008

I have asked about this again in the past, but now I come again with new data.

The question is about beeing able to implement inheritance between BOs. For instance there is the Contact BO which is the parent, and the there are the Customer BO, the Employee BO, the Supplier BO etc. which are all Contacts. Meaning that have all the properties and functionality of a Contact, and add more properties and methods of their own.

Trying to accomblish this I have found that (besides some warning of hidden method members), it is not possible for a the child object (Customer) to keep the properties of its parent (Contact) and add some more of its own. This is because of some DataColumn objects and Descriptors that are created and added to a list by the *.Designer code. For instance, no matter if you override the CreateTableSchema method in the Customer, the Contact DataColumns will not be added because the method in the Designer code does not call its base. And even if I modify this, the next partial build will overwrite the code.

Thus in general the child object cannot add properties of its own. Am I correct in this? Has anyone managed to accomblish inheritance?

So the next thing is to actually have two BOs in a single form, and different controls in the form to bind in different BOs.

I am asking all these as a general discussion because I am trying to establish some code standards, and I am trying to find out what I can and cannot do with the framework.

Thanks

By StrataFrame Team - 1/9/2008

The recommended way of supporting this through StrataFrame is to create a view that inner joins the super table and subtable (Contacts and Employees).  The business object would then be constructed from this view within the BOMapper.  You would then implement stored procedures for CRUD procedures (i.e. an INSERT would first insert a record into Contact and then use the PK for the value of the PK in Employees, an UPDATE would update both tables, and a DELETE would delete the record from both tables).  In order to share business logic between the subtype busienss objects (Employees and Customers that are both subtables of the supertable Contacts), you would need to place the business logic in a shared (static) location and call the methods from the sub business objects.
By Richard Keller - 1/18/2008

In this particular design I believe that Contacts are a Many >> One relationship between Customer, Supplier, etc and not a descendent of them.  It makes it very narrow and the data is not normalized.   

Just my .02 cents.

Richard