How can I copy/paste associations

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
jamesklett
Posts: 7
Joined: Tue 08 Jan 2013 17:42

How can I copy/paste associations

Post by jamesklett » Tue 08 Jan 2013 18:09

New NHibernate - Entity Developer user, I just ran the wizard on my existing large database, all entities came in so far so good, then I started the process of adding all the inherited sub classes, since our database has many single table hierarchies, the wizard only brought in the main table - entities, and all the fields and associations are loaded into the base class. I found that I can create the subclasses and copy pasted the fields/properties from the base class over to the sub-classes, great!. However It wont let me do that with the associations (navigation properties) Please tell me there is a simple way because my database is over 150 tables and the object model with inherited classes is huge, and I have many, many hundreds of associations to move down to all the sub classes.

thanks

JAMES

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: How can I copy/paste associations

Post by Shalex » Thu 10 Jan 2013 14:21

jamesklett wrote:all the fields and associations are loaded into the base class
Entity Developer loads fields and associations into the base model class when the TPH inheritance type is used. We consider that this behaviour is correct.

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: How can I copy/paste associations

Post by Shalex » Thu 10 Jan 2013 16:39

jamesklett wrote:I found that I can create the subclasses and copy pasted the fields/properties from the base class over to the sub-classes
There is a drag&drop functionality which allows to avoid copy/past-ing: http://www.devart.com/entitydeveloper/e ... eloper.chm > NHibernate > Concepts > Working with Inheritances > Table per Hierarchy.
jamesklett wrote:However It wont let me do that with the associations (navigation properties)
Please open Association Editor (right click on the association > Edit) and change the Relation Class property of the corresponding end from the base class to descendant.

jamesklett
Posts: 7
Joined: Tue 08 Jan 2013 17:42

Re: How can I copy/paste associations

Post by jamesklett » Thu 10 Jan 2013 17:04

1. It isn't correct because then all child classes will have acces to relations that don't make sense for them.

2. The edit option does not appear to work. Yes I change the class but the association do not move. It is still in the base class.

3. Drag drop does not work to move the association

thanks

JAMES

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: How can I copy/paste associations

Post by Shalex » Tue 15 Jan 2013 17:56

1. Entity Developer doesn't know about your model logic. That's why it adds an association to the base class of the TPH inheritance. You should modify the association manually.
2. We cannot reproduce the problem. Please send us a test model and specify the steps we should follow.
3. This is a designed behaviour. We are investigating the possibility of moving associations to childs of the TPH inheritance in a more easier way.

Post Reply