예제 #1
0
 /// <summary>
 /// Method to filter query by exclusion of a primary key or property value.
 /// </summary>
 /// <typeparam name="T">The Class type of entity.</typeparam>
 /// <param name="query">A query of entities.</param>
 /// <param name="op">Entities options list.</param>
 /// <param name="pk">The name of the column or property to filter.</param>
 public static void QueryListExclude <T>(this IQueryable <T> query, EntitiesOptionsList op, string pk = "PrimaryKey") where T : class
 {
     if (op.ExcludePrimaryKeys != null && op.ExcludePrimaryKeys.Count > 0)
     {
         query = query.Where(x => !op.ExcludePrimaryKeys.Contains((int)x.GetPropertyValue(pk, false)));
     }
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T">The Class type of entity.</typeparam>
 /// <param name="query"></param>
 /// <param name="op"></param>
 /// <returns></returns>
 public static void QueryStartLimit <T>(this IQueryable <T> query, EntitiesOptionsList op) where T : class
 {
     query.QueryStartLimit(op.Start, op.Limit);
 }
예제 #3
0
 /// <summary>
 /// Method to filter by inclusion and exclusion of a primary key or property value.
 /// </summary>
 /// <typeparam name="T">The Class type of entity.</typeparam>
 /// <param name="query">A query of entities.</param>
 /// <param name="op">Entities options list.</param>
 /// <param name="pk">The name of the column or property to filter.</param>
 public static void QueryListFilter <T>(this IQueryable <T> query, EntitiesOptionsList op, string pk = "PrimaryKey") where T : class
 {
     query.QueryListInclude(op, pk);
     query.QueryListExclude(op, pk);
 }