Views,Entity,Cannot deduce a primary key

浪子不回头ぞ 提交于 2020-01-17 05:14:31

问题


I made a view so the back hand of my website is more coherent. Then i tried to map it to my entity schema.

I had the message :

No primary key defined, could not deduce a primary key, table excluded

So i made one ! I made sure it was something unique by combining 3 columns that cannot be identical when combined. And i called that new column "id".

Entity dosen't seems to agree with the unique aspect of my "id" because the error message wont go away and i can't import my view...


回答1:


Well, i had to use the sql function ISNULL(id,) on my "id" clolumn, making it a not null value so Entity understand that it could NEVER be null and therefore, detecting it as a potential primary key



来源:https://stackoverflow.com/questions/39795871/views-entity-cannot-deduce-a-primary-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!