///
/// Gets {propertyName}.
///
/// The database context.
/// How many {propertyName} to skip.
/// How many {propertyName} to take. (Default = 50)
/// Optional Order direction
/// Optional where predicate.
/// Optional order by predicate.
/// A bool if the result is successful and a projection of the first occurrence of {propertyName}.
public static (bool, {returnTypeFullName}[]) Get{propertyName}(this {contextFullName} dbContext, int skip = 0, int take = 50, int orderDir = 1,
Expression > where = null,
Expression > orderBy = null)
{
if (take > 200) take = 200;
var query = dbContext
.{propertyName}
.Select(x => new {returnTypeFullName}(x));
.Skip(skip)
.Take(take);
if (where != null) query = query.Where(where);
if(orderBy != null)
{
if (orderDir == 1) query = query.OrderBy(orderBy);
else query = query.OrderByDescending(orderBy);
}
return (query.Any(), query.ToArray());
}