public bool TryCreate <TEntity>(IQuerySpecification <TEntity> specification, out IQueryPipe <TEntity> pipe) where TEntity : class { if (specification is IAsTrackingQuerySpecification <TEntity> ) { pipe = new AsTrackingQueryPipe <TEntity>(); return(true); } pipe = null; return(false); }
public void Apply_EnablesChangeTracker() { var pipe = new AsTrackingQueryPipe <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.Equal(expectedCount, context.ChangeTracker.Entries().Count()); }