开发者

How can I access two or more identical tables using Entity Framework Model

For each manufacturing cycle a new identically structured table is created in a DB; call them M100, M101, etc. I want to point my Entity Framework m开发者_如何学Pythonodel to different instances of the tables. How can I do this? Note the tables are in the same database so it's not a matter of modifying the connection string.


EF doesn't have native support for this type of tables. In EF one class = one mapping = one table (except special cases like inheritance or splitting). Moreover it is supposed that all these features are defined at design time and database doesn't change at runtime.

Simple advice is: don't use EF for that. Use direct SQL or some SQL abstraction (view, stored procedures) between tables and EF. Otherwise you will have to manipulate mapping per request and it is not easy - it means manipulating EDMX file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜