0
表1:文章表示一个帮助台在实体框架
表2:ArticleCategories
我怎样表示它是1-> 1的关系的两个表之间的关系:
我可以做到以下几点,但我不知道这是正确的做法:
public class Article
{
public int ArticleIndex { get; set; }
public int Category { get; set; }
public Guid User { get; set; }
public int Parent { get; set; }
public int Level { get; set; }
public int Order { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateExpires { get; set; }
public bool Show { get; set; }
public string Title { get; set; }
public string TitleHtml { get; set; }
public string Content { get; set; }
public string ContentHtml { get; set; }
public string ShortTitle { get; set; }
public ArticleCategory Category { get; set; }
}
public class ArticleCategory
{
public int CategoryIndex { get; set; }
public string Name { get; set; }
}
您是否使用代码第一次? – devuxer
是............................................ – user560498
不要你的意思是一个1->多种关系? *一个*类别有*许多*文章和一篇文章属于*一个*类别? – Slauma