开发者

Entity Types not mapped but stored

开发者 https://www.devze.com 2023-04-04 10:04 出处:网络
I\'ve a problem mapping just one table from database, I add several tables using \"Update model from Database\" function through Visual Studio 2010 interface, and everyone works as expected except one

I've a problem mapping just one table from database, I add several tables using "Update model from Database" function through Visual Studio 2010 interface, and everyone works as expected except one table!

Looking at "Model Browser" I can see the table doesn't appear 开发者_如何转开发under "Entity Types" but it is present under section "ObjectEntity.Store", so my POCO Generator create an entity related and I can't try to add it again from database but I can't access it through context (like context.table_name).

Tha table doesn't have particular form, there are just two key fields

Could someone help me?

Thanks


I guess it is junction table for implementing many-to-many relation, isn't it? In such case it is correct behavior. EF will hide this table because it is not needed in object oriented approach where many-to-many association can be modeled directly without helper entity. You will see in your model that those two related entities are connected by line with * - * multiplicity and each entity will contain navigation property which is collection of related entities. By manipulation with entities in these collections you are creating or removing records in that hidden table. That is the way how you work with such relation in EF.

0

精彩评论

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