Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 实体框架处理实体的删除_C#_Entity Framework_Frameworks_Entity - Fatal编程技术网

C# 实体框架处理实体的删除

C# 实体框架处理实体的删除,c#,entity-framework,frameworks,entity,C#,Entity Framework,Frameworks,Entity,我是EF的新手,在寻找删除参考实体的干净解决方案时遇到了困难: public class UserAccess : CloneableBaseEntity<UserAccess> { public User User { get; set; } public Site Site { get; set; } public CostCenter CostCenter { get; set; } public Product Product { get; s

我是EF的新手,在寻找删除参考实体的干净解决方案时遇到了困难:

public class UserAccess : CloneableBaseEntity<UserAccess>
{
    public User User { get; set; }
    public Site Site { get; set; }
    public CostCenter CostCenter { get; set; }
    public Product Product { get; set; }
}
公共类用户访问:CloneableBaseEntity
{
公共用户{get;set;}
公共站点站点{get;set;}
公共成本中心成本中心{get;set;}
公共产品产品{get;set;}
}
案例1:

删除用户时,还应删除用户访问权限

案例2

当产品被删除时,Useraccess应该仍然存在


有什么想法吗?

标记用户和用户访问之间的关系以进行级联删除