-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Description
I have the IdentificationType class:
public sealed record IdentificationType
{
public int Id { get; }
public string Alias { get; }
private IdentificationType(int id, string alias)
{
this.Id = id;
this.Alias = alias;
}
public bool Equals(IdentificationType? left) => this.Alias == left?.Alias;
public override int GetHashCode() => this.Alias.GetHashCode();
}The property Alias is configured as Alternate key, and the Id as Primary key.
I want to use the Equals method in Ef core, in this way:
public Task<IdentificationType?> Find(IdentificationType identificationType)
{
return dbContext.IdentificationType
.AsExpandableEFCore()
.SingleOrDefaultAsync(i => i.Equals(identificationType));
}When the Find method is invoked, Ef core uses Id instead of Alias.
How I could configure LinqKit to expand the Equals method?
Metadata
Metadata
Assignees
Labels
No labels