In order to write the filter only one time I suggest you to add custom EndPoints
for the entities that have IS_DELETED
column in the database by extending your Domain Model
with a partial class.
For your convenience I prepared the following two-step tutorial demonstrating that approach.
1. Create a partial class.
2. Implement new EndPoints.
// e.g. OpenAccessModel
// e.g. EntitiesModel
// e.g. endpoint for Employee with name NotDeletedEmployees
.GetAll<EntityName>().Where(e => !e.IsDeleted);
// the same endpoints for all of the entities you need
Please bear in mind that the partial class should be in the same assembly and in the same namespace as your Domain Model
After that you will be able to choose whether to get all of the records from the database or only the filtered one without manually writing the filter each time – look at the example below:
(EntitiesModel context =
// get all employees from the database
IEnumerable<Employee> allEmployees = context.Employees;
// get only the employees that are not marked as deleted
IEnumerable<Employee> filteredEmployees = context.FilteredEmployees;
I hope this is applicable for you.
All the best,
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.