我正在使用EF6。我有2个表事件和用户,我使用数据库第一种方法来生成EDMX模型和实体类。一切正常,但在这种情况下,实体类属于单个文件EventSample.cs(如下所示)。我没有为每个实体获取单独的文件,如Event.cs和User.cs.如果这是正确的,请告诉我,如果不是,如何纠正它?
public partial class Event
{
public Event()
{
this.Users = new HashSet<User>();
}
public int Id { get; set; }
public string Title { get; set; }
public System.DateTime Time { get; set; }
public string Location { get; set; }
public string Description { get; set; }
public int Creator_Id { get; set; }
public virtual User User { get; set; }
public virtual ICollection<User> Users { get; set; }
}
public partial class User
{
public User()
{
this.Events = new HashSet<Event>();
this.Events1 = new HashSet<Event>();
}
public int Id { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public virtual ICollection<Event> Events { get; set; }
public virtual ICollection<Event> Events1 { get; set; }
}