[EF-66] ShadowProperty of type ObjectId is unsupported Created: 15/Oct/23 Updated: 20/Oct/23 Resolved: 20/Oct/23 |
|
| Status: | Closed |
| Project: | Entity Framework |
| Component/s: | None |
| Affects Version/s: | Public Preview 1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Bill Richards | Assignee: | James Kovacs |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
If an Entity is defined without an Id or _id property, and a Shadow Property is defined as part of the OnModelCreating method
System.NotSupportedException is thrown at runtime
It can be desirable to have the entity identifier implemented as a shadow property to enable models to be easily ported between SqlServer and MongoDB, for example. For MongoDB
For SqlServer
|
| Comments |
| Comment by James Kovacs [ 20/Oct/23 ] |
|
Hi, bill@greyskin.co.uk, Thank you for trying out Public Preview 1 of our EF Core Provider for MongoDB. Public Preview 1 does not implement support for shadow properties as noted in the Limitations & Roadmap. Id (which is serialized as _id in the database) is a required field for all documents stored in MongoDB as it represents the unique identifier for a document and serves the same purpose as a primary key in a relational database. While _id defaults to ObjectId, it can be any scalar type (int, string, GUID, etc.) or even a compound key. We may decide to add support for shadow properties in a future version. Sincerely, |