开发者

Problem with mapping a table with a view with Entity Framework 1 (3.5)

We have a problem with an entity mapping. In fact we have a base that contains a part on the information on the employee and a view that retrieves the rest of the in开发者_JS百科formation in an other base. The data provided by the view are readonly (for the moment we have created some stored procedures that do nothing) and map them to the view.

The problem is that the value used for the association with the view is not the primary key.

I have seen on some forum that we have to delete the value in the model because with ef1 you can't have the field in an association and in the table.

We still have this error :

Error 2026: AssociationSet instances may only be mapped using functions in one EntitySetMapping or AssociationSetMapping. The following AssociationSet instances are mapped in multiple locations: employee_schoolingvEmployees

Thanks


Principal property used for the association with the view must be a primary key. In case of one-to-one relation it must relate to primary key of dependent entity.

Your error says mostly nothing. That is for checking whole your EDMX file (open it as XML and it should show you where the problem is).

Anyway you already have a view, you must already use stored procedures so why didn't you create a view for Employee itself joining your table and view and added stored procedures for insert, update and delete for this new view (they will perform changes only in Employee table at the moment)?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜