Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

Creating Edit View with Non EFModel #1096

Open
GaryFurash opened this issue Mar 22, 2020 · 0 comments
Open

Creating Edit View with Non EFModel #1096

GaryFurash opened this issue Mar 22, 2020 · 0 comments

Comments

@GaryFurash
Copy link

Using latest ASP.NET Core with latest Nuget on Visual Studio 2019 windows 10 pro.

If I try to create an Edit view based on a view model that isn't configured in the DB context (e.g., it's a model that doesn't map to a DB table in EF), even after adding the [Key] annotation I get the error:

'The entity type 'RoleEdit' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'.'

I can't use HasNoKey since the model entity isn't in the context since it isn't a real table.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant