Shared-type entities (part of property bag entities)
See original GitHub issueThere are entity types that don’t have a natural mapping to a CLR type, either because they aren’t part of the domain model (e.g. many-to-many join types) or because the CLR types are inaccessible (e.g. migration snapshot). While these could be mapped to shadow entity types #749 that would make working with them harder as they are tightly coupled to the state manager and would need special case handling throughout the stack, especially in the query pipeline.
Property bag entity types are still fully specified at model building time, dynamic types are tracked by #2282. The basic implementation would add support for entities backed up by a Dictionary<string, object> with a predefined entry that contains the entity type name.
Usage:
modelBuilder.Entity("Cat", c =>
{
c.Property<int>("Id");
c.Property<string>("Name");
});
context.Add(new Dictionary<string, object>
{
{ "Entity type name", "Cat" },
{ "Id", 123 },
{ "Name", "Tabby" }
});
Related to #2968
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:21 (14 by maintainers)
Top Related StackOverflow Question
Design meeting decisions:
Entity(string, Type)toSharedEntity(string, Type)SharedEntity(Type)that just marks the type as shared without creating any entity types. Removes entity types created by convention, throws for entity types configured explicitlyUsingEntitywill only create a STET if the CLR type is marked as sharedNotes from today’s design meeting regarding relationship APIs for shared type entity types.