-3
我有「用戶」和「出價」模型。實體框架和模型與一個類別的字段
Andcourse「Users」和「Bids」表在DateBase中。 ("Bid" columns in postgres table)
我可以映射一個「用戶」字段是這樣的:
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; }
}
不知道你要求什麼男人!你想要它做什麼? – jackncoke 2013-02-19 20:10:38
爲什麼這是不正確的? – cadrell0 2013-02-19 20:34:23
試着更清楚你的要求,並希望你的選票旁邊的負號會消失。如果你問我認爲你在問什麼,你應該可以在你的上下文的OnModelCreating方法中用流利的API來指定它。 – lintmouse 2013-02-19 22:06:10