开发者

Entity Framework Many-to-Many Madness

Entity Framework Many-to-Many Madness

Ok, don't shoot me for the following db structure. I inherited this, I did not create it. What I'm trying to do though is to simplify my life. I'm currently using EF 4.1 Code First and I know how to do man开发者_开发问答y-to-many mappings through tables with the fluent api, but I'm completely lost as to how to handle this structure. Bascially I'd like to be able to map from the IDB_interface table to the IDB_AddressIPv4 table by using a single navigation property? However, I'm guessing this isn't possible? Any constructive thoughts or suggestions would be greatly appreciated. Starting over isn't an option or changing the db structure.

Thanks in advance.


You must live with the structure you have. EF code first has no tools to help you. It can only simplify many-to-many relation with single junction table without additional data - that is not your case.

This is a case where it would be really handy to add additional layer on top of EF which would simplify your model to desired entities and your persistence logic will transform it to this horror.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜