Entity Framework 3.0 HasNoKey() for Key less table not working

Viewed 6084

I am started with .NET Core 3.0 and add ASP.NET Core identity. In tbl_SYS_AspNet_UserRoles there is no primary key.

enter image description here

Then I scaffold dbcontext and model for another tables in database, using Entity Framework Core tools reference - .NET CLI and Entity Framework generates e.HasNoKey() method in model builder. I also read doc from Microsoft Documentation .

But when I run the project and query for data dbcontext, I get an error:

'The navigation '' cannot be added because it targets the keyless entity type 'tbl_SYS_AspNet_UserRoles'. Navigations can only target entity types with keys.'

UPDATE

I opened an issue in github and they tag this as a bug.

0 Answers
Related