Difference between revisions of "Entity Framework"
From MgmtWiki
								
												
				 (→Troubleshooting)  | 
				 (→Troubleshooting)  | 
				||
| Line 10: | Line 10: | ||
==Troubleshooting==  | ==Troubleshooting==  | ||
| − | * [https://stackoverflow.com/questions/60600835/the-entity-type-access-requires-a-primary-key-to-be-defined-if-you-intended-t The entity type 'Access' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'] is an error that occurs if a POCO class is used in a   | + | * [https://stackoverflow.com/questions/60600835/the-entity-type-access-requires-a-primary-key-to-be-defined-if-you-intended-t The entity type 'Access' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'] is an error that occurs if a POCO class is used in a Dataset table that does not designed to be a db table in its own right. The answer is to mark the POCO class with an [owned] annotation.  | 
==References==  | ==References==  | ||
[[Category: Best Practice]]  | [[Category: Best Practice]]  | ||
Revision as of 11:54, 24 June 2021
Full Title
This wiki page is about the Microsoft ORM called Entity Framework including best practices and troubleshooting on ASP.NET.
Context
The context is a ASP.NET Core package version 5 or up that is deployed as a complete package.
Problems
Entity Framework assumes a configuration which makes it easy to get running, but hard to adapt to other environments.
Troubleshooting
- The entity type 'Access' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()' is an error that occurs if a POCO class is used in a Dataset table that does not designed to be a db table in its own right. The answer is to mark the POCO class with an [owned] annotation.