How can I interchangeably use entity base Id or database column Id
public partial class Orders : EntityBase<int>
{
protected Orders() { }
public int Orderid { get; set; }
public override int Id { get => base.Id; set => base.Id = Orderid; }
}
Entitybase:
public abstract class EntityBase<T> : IEntity<T>
{
public virtual T Id { get; set; }
}
Question: Can I map this Id of EntityBase and db column's primary key(for eg: order entity's key -> orderId) to sync values ( In app code, either user set Id of base or orderId of entity both should contain same value and also when retrieved also these values, at a given time, should return same value. Is there any way to achieve above synch feature via fluent API in the OnModelCreating()
method?
P.S: If you have not understood the question, please say which part does not have clarification, instead of using authority :)