public void Test() { var productList = _context.Product .Where(p => AdventureWorksContext.GetStock(p.ProductId) > 4) .ToList(); Assert.Equal(191, productList.Count); }
public void ShouldUseDbFunctionsInLinq() { //Notice the static method GetStock AdventureWorksContext.partial //that makes this work by mapping the function in the database //This makes the query use a database function so nothing is evaluated client-side var prodList = _context.Product .Where(p => AdventureWorksContext.GetStock(p.ProductId) > 4).ToList(); Assert.Equal(191, prodList.Count); }