public bool TryCreate <TEntity>(IQuerySpecification <TEntity> specification, out IQueryPipe <TEntity> pipe) where TEntity : class { if (specification is IAsNoTrackingQuerySpecification <TEntity> ) { pipe = new AsNoTrackingQueryPipe <TEntity>(); return(true); } pipe = null; return(false); }
public void Apply_DisablesChangeTracker() { var pipe = new AsNoTrackingQueryPipe <Customer>(); using var fixture = new NorthwindQueryInMemoryFixture <NoopModelCustomizer>(); using var context = fixture.CreateContext(); var results = pipe.Apply(context.Customers).ToList(); var expectedCount = fixture.QueryAsserter.ExpectedData.Set <Customer>().Count(); Assert.NotEqual(0, expectedCount); Assert.Equal(expectedCount, results.Count); Assert.Empty(context.ChangeTracker.Entries()); }