public static IQueryable <Petshop.Data.Entities.Item> ByProduct(this IQueryable <Petshop.Data.Entities.Item> queryable, ComparisonOperator comparisonOperator, Petshop.Data.Entities.Product product) { switch (comparisonOperator) { case ComparisonOperator.Equals: return(queryable.Where(i => i.Product == product)); case ComparisonOperator.NotEquals: return(queryable.Where(i => i.Product != product)); default: throw new ArgumentException("Parameter 'comparisonOperator' must be ComparisonOperator.Equals or ComparisonOperator.NotEquals to support Association type.", "comparisonOperator"); } }
public static IQueryable <Petshop.Data.Entities.Item> ByProduct(this IQueryable <Petshop.Data.Entities.Item> queryable, Petshop.Data.Entities.Product product) { return(queryable.ByProduct(ComparisonOperator.Equals, product)); }