sql server 2008 - How to create a relationship between table and view in the Entity Framework -


I have a unit framework model that was generated by the Visual Studio 2008 Wizard on a SQL Server 2008 database.

There is a view of the model that has entered into many-to-many relationships with another table through a logically joined table (applied to the database by an insert / update trigger) . Both tables are part of the visual model, but because you can not have a foreign key obstacle on a view, there is no connection between the view and the included table.

Is it possible to create a relationship between the Entity Table and the View in the Unit Framework Model for this link?

Thanks for any help.

Yes, you can do this, but the GUI designer will not be able to estimate it for you.

The first thing you need to do is the designer can not assess the primary key, so you will need that information.

Now you can right-click on the empty space in the designer and then choose to add an association.

In EF1, you will need to remove the FK field by pressing the client schema and selecting it in the designer. That's because, in EF1, you can not map the same field in both an association and a scalar property. If you use the FK Associations in EF4, you can keep the FK field, or you can use an independent association that behaves like EF1.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -