You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's not possible to store collections of primitive types in their own table so that we can easily query on those values. All proposed solutions are to serialize the collection but this does not allow for querying it's content easily or to create a class with a single property to represent the new table.
Through configuration it would be great to be able to define a table assigned to the collection so that it can be stored in it's own table with a foreign key referencing the parent entity. This could be configured like a collection of owned entities stored in it's own table where the value of the collection is the only column (with the foreign key).
modelBuilder.Entity<Role>().OwnsMany(
r =>r.Members,
b =>{b.ToTable("RoleMembers");b.WithOwner().HasForeignKey("RoleId");b.Property(b =>b).HasColumnName("Name");b.HasKey("RoleId","Name");});
would be persisted in 2 tables:
Roles
Id
Name
RoleMembers
RoleId
Name
The text was updated successfully, but these errors were encountered:
Currently it's not possible to store collections of primitive types in their own table so that we can easily query on those values. All proposed solutions are to serialize the collection but this does not allow for querying it's content easily or to create a class with a single property to represent the new table.
Through configuration it would be great to be able to define a table assigned to the collection so that it can be stored in it's own table with a foreign key referencing the parent entity. This could be configured like a collection of owned entities stored in it's own table where the value of the collection is the only column (with the foreign key).
So the entity:
with the following configuration:
would be persisted in 2 tables:
The text was updated successfully, but these errors were encountered: