Multiple "ObjectChangeTracker" getting created, can it be avoided?

Posted by user555937 on Stack Overflow See other posts from Stack Overflow or by user555937
Published on 2010-12-28T11:51:02Z Indexed on 2010/12/28 11:54 UTC
Read the original article Hit count: 216

Filed under:
|
|

Hi,

We are working on a POC where we have following architecture (MVVM),

WPF(Client) + WCF + Model(DataAccess)+ ADO.Net Entity Framework 4.0 (with SQL Server 2008 R2 as DB)

All are different projects.

In the DataAccess layer we have created different Entity Models(edmx) based on the functionality. The tables under perticular flow are grouped and created different entity models. We are using self tracking entities to and fro to communicate with the WPF client through wcf service. For Single model everything works fine. But when we created a Multiple models then few issues started coming. Mutliple models have few duplicate tables/entities. Two probels are,

1) When we try to access entities from different models mutiple objects "ObjectChangeTracker" are getting created. E.g. CompanyModel(edmx) - Company(Entity) - ObjectChangeTracker, ObjectState ProductModel(edmx) - Customer(Entity) - ObjectChangeTracker1, ObjectState1 OrderModel(edmx) - Oder(Entity) - ObjectChangeTracker2, ObjectState2

Is there any way to avoid this?

2) There are few tables which shared across the Models, E.g. Company(Entity) is used in All above mdoels. During compile time it does not thow any error. But run time It gives error saying "Schema specified is not valid. Errors: The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type "Company"".. To resolve this, we renamed the entities with some prefix to make them Unique. Is there any other way we can resolve this without changing the name of the entity in the same assembly?

Thanks in advance and appreciate if anyone has approach for these issues.

Thanks, Kiran

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wcf