first commit

This commit is contained in:
2026-06-02 20:48:16 +03:30
commit 8e92c983a2
233 changed files with 15744 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Complex.Infrastructure.Extensions
{
public static class QueryFilter
{
public static void ApplyGlobalFilters<T>(this ModelBuilder modelBuilder,
string propertyName, T value)
{
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
var foundProperty = entityType.FindProperty(propertyName);
if (foundProperty != null && foundProperty.ClrType == typeof(T))
{
var newParam = Expression.Parameter(entityType.ClrType);
var filter = Expression.Lambda(Expression.Equal(Expression.Property(newParam, propertyName),
Expression.Constant(value)), newParam);
modelBuilder.Entity(entityType.ClrType);
}
}
}
}
}