我有一个Useraccess类:
public class UserAccess : CloneableBaseEntity<UserAccess>
{
public int UserId { get; set; }
public User User { get; set; }
public int? SiteId { get; set; }
public virtual Site Site { get; set; }
public int? CostCenterId { get; set; }
public virtual CostCenter CostCenter { get; set; }
public int? ProductId { get; set; }
public virtual Product Product { get; set; }
}
该类派生自基本实体:
public class BaseEntity : ObservableObject
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime Created { get; set; }
public int CreatedUserId { get; set; }
public DateTime Changed { get; set; }
public int ChangedUserId { get; set; }
public BaseEntity()
{
}
}
网站,产品和成本中心公开此属性:
public virtual List<UserAccess> UserAccesses { get; private set; }
当我更新我的数据库时,UserAccess表中的列仍然不可为空。是什么导致了这种行为?