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
I want to be able to use Include without a database relation. This is possible using LINQ Join.
Right now the best example I have is where I want to be able to get log items when I get something that has been logged, but my log entity doesn't have relations to every other entity.
If I can add a navigation property wihtout a foreign key it would be clear to everyone that there is a relationship between the entities and it would be easier to work with includes than joins because how they are "joined" has already been set up in the DbContext configuration.
Example configuration for IEntityTypeConfiguration<User>:
builder
.HasMany(user => user.Logs)
.HasRelationWithoutForeignKey(user => new { Type = "User", Id = user.Id },
log => new { Type = log.Entity, Id = log.EntityId });
Used in code just like navigations properties today:
I want to be able to use
Include
without a database relation. This is possible using LINQJoin
.Right now the best example I have is where I want to be able to get log items when I get something that has been logged, but my log entity doesn't have relations to every other entity.
If I can add a navigation property wihtout a foreign key it would be clear to everyone that there is a relationship between the entities and it would be easier to work with includes than joins because how they are "joined" has already been set up in the DbContext configuration.
Example configuration for
IEntityTypeConfiguration<User>
:Used in code just like navigations properties today:
The text was updated successfully, but these errors were encountered: