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?
I have the
IdentificationTypeclass:The property
Aliasis configured as Alternate key, and theIdas Primary key.I want to use the
Equalsmethod in Ef core, in this way:When the
Findmethod is invoked, Ef core usesIdinstead ofAlias.How I could configure LinqKit to expand the
Equalsmethod?