© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•12mo ago•
36 replies
Kasumi

Unable to create a 'DbContext' of type ''. The exception 'The entity type 'SelectListGroup' requires

Hello,
everytime I want to create a migration I get this Error:

Unable to create a 'DbContext' of type ''. The exception 'The entity type 'SelectListGroup' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Unable to create a 'DbContext' of type ''. The exception 'The entity type 'SelectListGroup' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728


The funny thing is, I dont hae anywhere "SelectListGroup" defined like its nowhere.

Can someone help me there?

https://paste.mod.gg/pdgbqxsiwibr/2
BlazeBin - pdgbqxsiwibr
A tool for sharing your source code with the world!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Unable to create a 'DbContext' of type 'ApplicationDbContext'.
C#CC# / help
6mo ago
Unable to create DbContext
C#CC# / help
2y ago
❔ error: Unable to create a 'DbContext' of type '' ". When adding migration to MySQL database
C#CC# / help
3y ago
Exception about disposing DbContext
C#CC# / help
3y ago