我目前有兩個具有以下屬性的類。 Class1與Class2有關,並通過2個外鍵鏈接。 public class Class1
{
public int Id { get; set; }
public string Title { get; set; }
public int OwnerId { get; set; }
public int Modifie
我已經有一個數據庫(在__MigrationHistory表中有一個遷移歷史記錄)和一個從零創建的項目。我使用'Code First from Database'選項並且生成了所有類。現在,我想創建一個多個表,我創建了一個類: [Table("Companies")]
public partial class Company
{
[Key]
public int ID {
所以我想如下創建一個簡單的產品 - 預覽1對1的關係: public class Product : BaseEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
public string name { get
我有我添加了以下字段的類「用戶」: [Required]
public int CreatedBy_Id { get; set; }
[ForeignKey("CreatedBy_Id")]
public User CreatedBy { get; set; }
public int? UpdatedBy_Id { get; set; }
[
之間的關聯的主要結束我使用Entity Framework這裏是我的實體模型: Public class Document
{
Public int Id { get; set; }
Public Document Parent { get; set; }
}
,當你看到它有一個self-reference屬性。 現在我想要添加另一個self-reference屬性是這