Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var activeContracts = customer.Contracts.Where(w => w.ContractEndDate == null);
- var activeContracts = customer.ActiveContracts;
- var singleContractCustomers = db.Customers.Where(w => w.ActiveContracts.Count() == 1);
- public static Expression<Func<Customer, bool>> HasActiveContract
- {
- get { return cust => cust.Contracts.Count() == 1; }
- }
- var filtered = db.Customers.Where(Customer.HasActiveContract);
- public IQueryable<Customer> CustomersWithActiveContract
- {
- get { return Customers.Where(Customer.HasActiveContract); }
- }
- {SELECT [t0].[CustomerID], [t0].[cFirstName], [t0].[cLastName]
- FROM [dbo].[Customers] AS [t0]
- WHERE ((
- SELECT COUNT(*)
- FROM [dbo].[Contracts] AS [t1]
- WHERE (([t1].[ContractEndDate] > @p0) OR ([t1].[ContractEndDate] IS NULL)) AND ([t1].[cId] = [t0].[cId])
- )) > @p1
- }
Add Comment
Please, Sign In to add comment