开发者

Is it good practice to have a table referenced by two different entities?

I am building a application with these patterns: Silverlight, RIA, EF, Prism, SL Unit Testing.

This project will have lots of entities and lots of modules referenc开发者_JAVA百科ing those entities. Each entity is in its own RIA Service Library along with the RIA domain service and associated metadata.

I am running into problems when I reference a certain table in two different entities. For example table bar exists in entity1 and entity2.

My Question: Is it good practice to have the same table in multiple entities (.edmx files)?

If so what are good ways to avoid them causing a mulitple reference error?

If not what do I do when I need that table in another entity?


Normally, when you start working with EF (and most ORMs), you tend towards having an entity-per-table relationship, or at least, a table->entity hierarchy relationship, if you have inheritance in your entities.

If you're trying to refer to the same table from 2 separate entity types, you probably need to pull out a shared, single entity type that's refered to by both of your other entities.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜