New Posts New Posts RSS Feed: Map an inherited Entity to multiple tables
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Map an inherited Entity to multiple tables

 Post Reply Post Reply
Author
afrizal.chen View Drop Down
Newbie
Newbie
Avatar

Joined: 17-Dec-2008
Location: Singapore
Posts: 21
Post Options Post Options   Quote afrizal.chen Quote  Post ReplyReply Direct Link To This Post Topic: Map an inherited Entity to multiple tables
    Posted: 29-Dec-2009 at 1:48am
Hi,
I have this scenario where entity "AppointmentStatusType" is derived from "BaseCodeTable" (Map to table "BaseCodeTable". At the same time I want to extend its properties which is map to another table "AppointmentStatusEx". See image attached.

I saved and compiled this "DataModel".
Now the problem is when I try to save in the "DevForce Object Mapper", this error dialog appear:

Failed to save model file "D:\Projects\....\....\DomainModel.ibedmx".
Code generation compile error: Running transformation: System.ArgumentException: An item with the same key has  already been added.
  at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
  ...
  ...
Does this mean, this scenario is not supported by the object mapper. Please advise.

Thank you,
Afrizal
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 30-Dec-2009 at 10:31am
Afrizal:

Can you please create an Entity Data model with just these two entities, verify that you experience the same problem, and post the model here?  I will then try to reproduce the problem.

Thanks.
Back to Top
afrizal.chen View Drop Down
Newbie
Newbie
Avatar

Joined: 17-Dec-2008
Location: Singapore
Posts: 21
Post Options Post Options   Quote afrizal.chen Quote  Post ReplyReply Direct Link To This Post Posted: 30-Dec-2009 at 5:51pm
Hi Greg, Please find my sample project in the attachment. Open the object mapper and click save, you'll see the error message.
uploads/417/DevForceTest2.zip

thanks,
Afrizal
Back to Top
afrizal.chen View Drop Down
Newbie
Newbie
Avatar

Joined: 17-Dec-2008
Location: Singapore
Posts: 21
Post Options Post Options   Quote afrizal.chen Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jan-2010 at 5:05pm
Please find my SQLServer2005 BAK file in the attachment. The Database contains only two tables without any data, and this is the DB that I used to generate the EDMX.
uploads/417/MyTestDB.zip

by the way, I temporarily extend the base Table with additional two generic columns, and create a getter and setter in the derived entity class with a proper name property names. This solve my problem so far, well the other derived classes will also see these two generic columns that they do not use. Not a beautiful solution, but it works.... :)
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 07-Jan-2010 at 2:30pm
Afrizal:

With the additional materials you sent I have reproduced your issue, and also confirmed that the Entity Data Model seems to work fine (e.g., for data retrievals) in pure Entity Framework.  I'm passing my reproduction on to the Development staff to look at. Someone will contact you when we know more.

Greg

Back to Top
afrizal.chen View Drop Down
Newbie
Newbie
Avatar

Joined: 17-Dec-2008
Location: Singapore
Posts: 21
Post Options Post Options   Quote afrizal.chen Quote  Post ReplyReply Direct Link To This Post Posted: 07-Jan-2010 at 5:37pm
Thank you Greg. I'll use my workaround solution for now.
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 11-Jan-2010 at 10:43am
Thanks, Afrizal.

Our development staff has We reproduced the error and will try to have a fix for our April DevForce release.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down