我有一个包含“Id”字段的帐户对象,该字段映射到数据库中的视图:
public class Account : GeneralInfo
{
[Column("first_name")]
public string FirstName { get; set; }
[Column("last_name")]
public string LastName { get; set; }
public string Designation { get; set; }
[Column("full_name")]
public string FullName { get; set; }
public string Email { get; set; }
[Column("member_type")]
public string MemberType { get; set; }
[Column("status")]
public string Status { get; set; }
[Column("paid_thru")]
public DateTime? PaidThru { get; set; }
[Column("member_record")]
public bool MemberRecord { get; set; }
[Column("category")]
public string Category { get; set; }
public virtual Subscription Subscriptions { get; set; }
}
我还有一个订阅对象,它使用与帐户对象相同的“Id”:
[Table("Subscriptions")]
public class Subscription
{
[Column("Id")]
public string ID { get; set; }
[Column("Balance")]
public decimal Balance { get; set; }
}
当我尝试使用“订阅”作为帐户的导航属性时,我收到一条错误消息: {"Invalid column name 'Subscriptions_ID'."}
如何使用 Account 对象访问“订阅”?