public static SievePropertyMapper ApplyConfiguration <T>(this SievePropertyMapper mapper) where T : ISieveConfiguration, new() { var configuration = new T(); configuration.Configure(mapper); return(mapper); }
public SieveProcessor(IOptions <SieveOptions> options, ISieveCustomFilterMethods customFilterMethods) { mapper = MapProperties(mapper); _options = options; _customFilterMethods = customFilterMethods; }
public PropertyFluentApi(SievePropertyMapper sievePropertyMapper, Expression <Func <TEntity, object> > expression) { _sievePropertyMapper = sievePropertyMapper; (_fullName, _property) = GetPropertyInfo(expression); _name = _fullName; _canFilter = false; _canSort = false; }
public static SievePropertyMapper ApplyConfigurationsFromAssembly(this SievePropertyMapper mapper, Assembly assembly) { foreach (var type in assembly.GetTypes().Where(t => !t.IsAbstract && !t.IsGenericTypeDefinition)) { // Only accept types that contain a parameterless constructor, are not abstract. var noArgConstructor = type.GetConstructor(Type.EmptyTypes); if (noArgConstructor is null) { continue; } if (type.GetInterfaces().Any(t => t == typeof(ISieveConfiguration))) { var configuration = (ISieveConfiguration)noArgConstructor.Invoke(new object?[] { }); configuration.Configure(mapper); } } return(mapper); }
public SieveProcessor(IOptions <SieveOptions> options) { mapper = MapProperties(mapper); _options = options; }
protected virtual SievePropertyMapper MapProperties(SievePropertyMapper mapper) { return(mapper); }