MVC 5 EF Soft Delete

时间:2015-10-19 12:59:27

标签: entity-framework

我基于以下链接来实现逻辑delet。https://github.com/rowanmiller/Demo-TechEd2014 问题是此解决方案会删除包含已删除字段的所有记录

[SoftDelete("IsDelete")]
public class Pusher
{
    [Key]
    public int IdPusher { get; set; }

    public string Name { get; set; }

   public bool IsDelete { get; set; }

}

[SoftDelete("IsDelete")]
public class Task
{
    [Key]
    public int IdTask { get; set; }     

    public int IdPusher { get; set; }
    public virtual Pusher Pusher { get; set; }  

    public bool IsDelete { get; set; }        

}

如果删除推送器,GetAll方法

将不再显示包含它的所有任务

0 个答案:

没有答案