我有“用户”和“投标”模型。
当然还有 DateBase 中的“Users”和“Bids”表。(postgres 表中的“投标”列)
我可以像这样映射一个“用户”字段:
public int UserId { get; set; }
public virtual User User { get; set; }
但不知道如何映射三个具有不同名称的“用户”字段。
public int CreatorId { get; set; }//id of user in db table
public int ManagerId { get; set; }//id of user in db table
public int ExecutorId { get; set; }//id of user in db table
public virtual User Creator { get; set; }
public virtual User Manager { get; set; }
public virtual User Executor { get; set; }
我应该怎么办?
public class Bid
{
public int BidId { get; set; }
public string Title { get; set; }
public string Text { get; set; }
public DateTime DateOfCreating { get; set; }
public DateTime DateOfProcessing { get; set; }
public DateTime DateOfExecution { get; set; }
//here is something incorrect
public int CreatorId { get; set; }
public int ManagerId { get; set; }
public int ExecutorId { get; set; }
public virtual User Creator { get; set; }
public virtual User Manager { get; set; }
public virtual User Executor { get; set; }
public bool IsProcessed { get; set; }
public bool IsExecuted { get; set; }
public bool IsExecutionConfirmed { get; set; }
}