Is there a way to use switchable?

Nov 2, 2010 at 3:22 PM

Hi,

In my current projet i need to use a ERList and a ECList object, i need to make a form to edit my data and somewhere else i need my data to be a child of an other object. So it is possible to make switchable object with the code generator?

Thanks you.

-Benoit

Coordinator
Nov 2, 2010 at 7:07 PM

This is the most requested feature so I guess I'll have to implement switchable objects. Until then, you can solve your problem by using a helper class. On the designer select EditableChildList (ECList), and use that list for all navigation properties where you need that list as a child object. After that, write a new EditableRoot class by hand (eg. ECListHelper) which contains only one property "ECList" and is used just to load and save ECList to the database. All other code should be placed in the ECList. The Helper class should contain only few lines of code. If you need an example I'll write it for you. Is this solution ok for you now?

As a general recommendation, I think you should consider splitting one complex object in a few smaller objects for specific use cases. You can even use different EF models for different use cases. I use database views to create read-only objects with only needed fields from the database. I also use two or more EF models to split business logic in smaller areas. That way you can use one EF model for main business logic, and another for management of common data (States, Places etc).

Regards,

Josip

Coordinator
Nov 2, 2010 at 7:07 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.