/// <summary> /// Creates a conditional where statement that handles both AND and OR conditions /// </summary> /// <param name="context">The graphql context to of the query</param> /// <param name="models">A queryable to apply the condition over</param> /// <param name="argName">The name of the graphql arg to fetch from the context</param> /// <typeparam name="T">The type of the model to apply the conditional over</typeparam> /// <returns>A new queryable that has the conditions applied</returns> /// <see cref="QueryableExtensions.AddConditionalWhereFilter{T}"/> public static IQueryable <T> CreateConditionalWhere <T>( ResolveFieldContext <object> context, IQueryable <T> models, string argName = "conditions") where T : IOwnerAbstractModel { if (context.HasArgument(argName)) { var wheres = context.GetArgument <List <List <WhereExpression> > >(argName); return(models.AddConditionalWhereFilter(wheres)); } return(models); }