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