initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Domain.Common;
|
||||
|
||||
namespace Application.Common.Extensions;
|
||||
|
||||
|
||||
public static class QueryableExtensions
|
||||
{
|
||||
public static IQueryable<T> ApplyIsDeletedFilter<T>(this IQueryable<T> query, bool isDeleted = false) where T : class
|
||||
{
|
||||
if (typeof(IHasIsDeleted).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
query = query.Where(x => (x as IHasIsDeleted)!.IsDeleted == isDeleted);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user