public bool TryCreate <TEntity>(IQuerySpecification <TEntity> specification, out IQueryPipe <TEntity> pipe) where TEntity : class { if (specification is IIgnoreQueryFiltersQuerySpecification <TEntity> ) { pipe = new IgnoreQueryFiltersQueryPipe <TEntity>(); return(true); } pipe = null; return(false); }
public void Apply_IgnoresQueryFilter() { var pipe = new IgnoreQueryFiltersQueryPipe <CustomerQuery>(); using var fixture = new NorthwindQueryInMemoryFixture <NoopModelCustomizer>(); using var context = fixture.CreateContext(); var queryRoot = context.Set <CustomerQuery>(); var countBefore = queryRoot.Count(); Assert.NotEqual(0, countBefore); var countAfter = pipe.Apply(queryRoot).Count(); Assert.NotEqual(countBefore, countAfter); }