This repository contains code to show how to use HasQueryFilter
to provide soft deletes against any model which implements a specific Interface.
- Run the following script to create the database and populate tables.
- From Visual Studio solution explorer select Restore Nuget packages.
- Ensure
WindowsFrontEnd
orWindowsFrontEndCore5
is the startup project. - Build the solution
- Run
- Microsoft Framework 4.7.2 or higher
- Microsoft Visual 2017 or higher
- Microsoft SQL-Server 2012 or higher
- Microsoft Framework .NET Core 5, C# 9
- Microsoft Visual 2019 or higher
- Microsoft SQL-Server 2012 or higher
private void RemoveCurrentSupplierButton_Click(object sender, EventArgs e)
{
var currentSupplier = _supplierBindingSource.Current as Suppliers;
if (!Question($"Remove {currentSupplier.CompanyName}")) return;
using (var context = new NorthwindContext())
{
context.Entry(currentSupplier).State = EntityState.Deleted;
context.SaveChanges();
_supplierBindingSource.RemoveCurrent();
}
}