【发布时间】:2017-07-27 12:44:02
【问题描述】:
我想将一个字符串字段关联为外键,我需要帮助!
catalogtype.code => catalog.typeCatalogRefCode
public class CatalogType : AuditFields
{
[Key]
public int id { get; set; }
public string name { get; set; }
public string description { get; set; }
public string code { get; set; }
public bool passive { get; set; }
public ICollection<Catalog> Catalogs { get; set; }
}
public class Catalog : AuditFields
{
[Key]
public int id { get; set; }
public string value { get; set; }
public string description { get; set; }
public string code { get; set; }
public bool passive { get; set; }
public int order { get; set; }
public string typeCatalogRefCode { get; set; }
public virtual CatalogType catalogType { get; set; }
}
.................................................. …………
public class AuditFields
{
public DateTime createdDate { get; set; }
public string createdBy { get; set; }
public string createdIn { get; set; }
public DateTime modifiedDate { get; set; }
public string modifiedBy { get; set; }
public string modifiedIn { get; set; }
}
【问题讨论】:
标签: c# asp.net-mvc-5 foreign-keys