问题
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