New Posts New Posts RSS Feed: Same entity type in multiple managers
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Same entity type in multiple managers

 Post Reply Post Reply
Author
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Topic: Same entity type in multiple managers
    Posted: 06-Nov-2013 at 6:18pm
Hi Kim,

These are already in separate projects, but it is structured like this:

Common project:
  Address

Project1:
   Project1Entities has a definition for Common.Address

Project2:
  Project2Entities has a definition for Common.Address

I think if I was to have an Address in each project that inherits from Common.Address that would effectively solve the problem.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2013 at 6:14pm
The ibmmx does actually contain data source key and other information for each entity, and you'll see this entity in each ibmmx.  The problem is that DevForce generally stores metadata keyed by the type, so will only recognize one set of metadata for a specific type.  Another workaround would be to put these models in separate projects and use a different namespace in each for the common entity definition, so that effectively you have two different types.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2013 at 3:48pm
One solution I came up with would be to make all our common types abstract and simply have a blank implementation of them in each model. It isn't ideal, but it would work if that's the only realistic solution.

Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2013 at 2:27pm
There appears to be a problem when using CodeFirst and sharing the same entity in two managers.

Example:

   ProductAEntities
           Setting

  ProductBEntities
           Setting

When you query for Setting under a typed EntityManager, there is nothing distinguishing between a query for Setting on ProductAEntities vs ProductBEntities.

In the EntityServerQueryInterceptor.GetDataSourceKey() it simply looks for the type, which may exist in multiple Data Sources.

Any suggestions?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down