本文整理汇总了C#中ICriterion类的典型用法代码示例。如果您正苦于以下问题:C# ICriterion类的具体用法?C# ICriterion怎么用?C# ICriterion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICriterion类属于命名空间,在下文中一共展示了ICriterion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PresortBestSplitter
public PresortBestSplitter(ICriterion criterion,
uint max_features,
uint min_samples_leaf,
Random random_state)
: base(criterion, max_features, min_samples_leaf, random_state)
{
}
示例2: GetColumnNamesUsingPropertyName
private static SqlString[] GetColumnNamesUsingPropertyName(
ICriteriaQuery criteriaQuery,
ICriteria criteria,
string propertyName,
object value,
ICriterion critertion)
{
string[] columnNames = criteriaQuery.GetColumnsUsingProjection(criteria, propertyName);
IType propertyType = criteriaQuery.GetTypeUsingProjection(criteria, propertyName);
if (value != null && !(value is System.Type) && !propertyType.ReturnedClass.IsInstanceOfType(value))
{
throw new QueryException(string.Format(
"Type mismatch in {0}: {1} expected type {2}, actual type {3}",
critertion.GetType(), propertyName, propertyType.ReturnedClass, value.GetType()));
}
if (propertyType.IsCollectionType)
{
throw new QueryException(string.Format(
"cannot use collection property ({0}.{1}) directly in a criterion,"
+ " use ICriteria.CreateCriteria instead",
criteriaQuery.GetEntityName(criteria), propertyName));
}
return Array.ConvertAll<string, SqlString>(columnNames, delegate(string col)
{
return new SqlString(col);
});
}
示例3: CriteriaQuery
public CriteriaQuery(ICriterion criteria)
{
if (criteria != null)
{
this.criterion = criteria;
this.criterion.SetQuery(this);
}
}
示例4: FindChildren
private IEnumerable<FileSystemItem> FindChildren(FileSystemPath path, ICriterion criterion)
{
return Session.CreateCriteria<FileSystemItem>()
.Add(Restrictions.Eq("Path.Parent", path.ToString()))
.Add(criterion)
.AddOrder(Order.Asc("Path.Name"))
.SetCacheable(true)
.List<FileSystemItem>();
}
示例5: SplitterBase
public SplitterBase(ICriterion criterion,
uint max_features,
uint min_samples_leaf,
Random random_state)
{
this.criterion = criterion;
this.max_features = max_features;
this.min_samples_leaf = min_samples_leaf;
this.random_state = random_state ?? new Random();
}
示例6: AddCriterionToCriteria
/// <summary>
/// Adds a collection of ICriterion to an ICriteria.
/// </summary>
/// <param name="criteria">The ICriteria that will be modified.</param>
/// <param name="criterions">The collection of Criterion.</param>
internal static void AddCriterionToCriteria(ICriteria criteria, ICriterion[] criterions)
{
if (criterions != null)
{
foreach (ICriterion cond in criterions)
{
criteria.Add(cond);
}
}
}
示例7: CountQuery_ByTypeAndCriteria
public void CountQuery_ByTypeAndCriteria()
{
Prepare();
ICriterion[] criterionArray = new ICriterion[]
{
Expression.Eq("Category", "c")
};
CountQuery cq = new CountQuery(typeof(Post), criterionArray);
int recordCount = (int)ActiveRecordMediator.ExecuteQuery(cq);
Assert.AreEqual(2, recordCount);
}
示例8: GetFunctionCriteria
public static SqlFunctionExpression GetFunctionCriteria(MethodCallExpression call, ICriterion criterion,
SqlFunctionExpression rightFunction)
{
System.Type[] paramTypes = null;
object[] paramValues = GetMethodParameterValues(call, out paramTypes);
int propertyPosition = 0;
string methodName = QueryUtil.GetMethodName(call, out propertyPosition);
return new SqlFunctionExpression(methodName, call.Method.ReturnType, paramValues, paramTypes, criterion,
propertyPosition, rightFunction);
}
示例9: SqlFunctionExpression
public SqlFunctionExpression(String functionName, System.Type returnType, Object[] paramValues,
System.Type[] paramTypes, ICriterion innerCriterion, int propertyPosition,
SqlFunctionExpression rightFunction)
{
FunctionName = functionName;
ReturnType = returnType;
ParameterValues = paramValues;
ParameterTypes = paramTypes;
InnerCriterion = innerCriterion;
PropertyPosition = propertyPosition;
RightFunction = rightFunction;
}
示例10: Find
public static IList Find(ICriterion crit, Type type, PagerInfo pi)
{
ISession s = Sessions.GetSession();
try
{
ICriteria c = s.CreateCriteria(type);
if (crit != null ) c.Add(crit);
if (pi != null )
{
c.SetFirstResult(pi.FirstResult);
c.SetMaxResults(pi.MaxResults);
}
return c.List();
}
finally
{
s.Close();
}
}
示例11: KPGridJsonProperties
public KPGridJsonProperties(bool isSearch, int page, int rows,
string propertyOrder, string orderTypeJason,
string filterJson, KPSessionJQGrid sessionJQGrid, string propertyCompany,
ICriterion initialFilter, Order initialOrder, object[] colModel)
{
IsSearch = isSearch;
Page = page;
Rows = rows;
PropertyOrder = propertyOrder;
OrderTypeJson = orderTypeJason;
User = sessionJQGrid.SecuritySession.Login;
Company = sessionJQGrid.SecuritySession.FrwCompany;
PropertyCompanyEntity = propertyCompany;
FilterJson = filterJson;
ColModel = Array.ConvertAll<object, string>(colModel, Convert.ToString);
List<JqGridColumnCustom> jqGridColumnCustomList = new List<JqGridColumnCustom>();
foreach (string item in ColModel)
jqGridColumnCustomList.Add(KPJsonJqGrid.GetColumnCustom(item));
ColumnsCustom = jqGridColumnCustomList.ToArray();
InitialFilter = initialFilter;
InitialOrder = initialOrder;
}
示例12: KPJqGridControl
public KPJqGridControl(string primaryKey, HiddenField hiddenKey, Type typeEntity, KPItemModelCollection KPitemsModel,
KPJqGridDoubleClickActionEnum DoubleClickAction, ICriterion filter, Order order)
{
#region Filter/Order
this.InitialFilter = filter;
this.InitialOrder = order;
#endregion
this.HiddenKey = hiddenKey == null ? new HiddenField() : hiddenKey;
this.Caption = String.Empty;
this.PrimaryKey = primaryKey;
this.UrlService = System.Web.VirtualPathUtility.ToAbsolute("~/WCF/EntityService.svc/GetEntityFilter");
this.TypeEntity = typeEntity;
this.KPItemsModel = KPitemsModel;
this.DoubleClickAction = DoubleClickAction;
this.RowNum = KPJqGridRowNumEnum.RowsView_10;
this.OrderRecords = KPJqGridTypeOrderEnum.ASC;
this.ViewTotalRecordsLabel = true;
this.Height = 100;
this.Width = 300;
}
示例13: GetColumnNamesForSimpleExpression
public static SqlString[] GetColumnNamesForSimpleExpression(
string propertyName,
IProjection projection,
ICriteriaQuery criteriaQuery,
ICriteria criteria,
IDictionary<string, IFilter> enabledFilters,
ICriterion criterion,
object value)
{
if (projection == null)
{
return GetColumnNamesUsingPropertyName(
criteriaQuery,
criteria,
propertyName,
value,
criterion);
}
else
{
return GetColumnNamesUsingProjection(projection, criteriaQuery, criteria, enabledFilters);
}
}
示例14: AddCriterionEvent
public AddCriterionEvent(ICriterion criterion)
{
this.criterion = criterion;
}
示例15: FindAllStateless
/// <summary>
/// Returns all instances found for the specified type
/// using criteria and IStatelessSession.
/// </summary>
/// <param name="type">The target type.</param>
/// <param name="criterias">The criteria expression</param>
/// <param name="sortItems">An <see cref="Array"/> of <see cref="Order"/> objects.</param>
/// <param name="firstRow">The number of the first row to retrieve.</param>
/// <param name="maxRows">The maximum number of results retrieved.</param>
/// <returns>The <see cref="Array"/> of results.</returns>
public virtual Array FindAllStateless(Type type, ICriterion[] criterias, Order[] sortItems, int firstRow, int maxRows)
{
using (IStatelessSession session = GetStatelessSession())
{
try
{
ICriteria criteria = session.CreateCriteria(type);
if (criterias != null)
{
foreach (ICriterion cond in criterias)
{
criteria.Add(cond);
}
}
if (sortItems != null)
{
foreach (Order order in sortItems)
{
criteria.AddOrder(order);
}
}
if (firstRow != int.MinValue) criteria.SetFirstResult(firstRow);
if (maxRows != int.MinValue) criteria.SetMaxResults(maxRows);
IList result = criteria.List();
Array array = Array.CreateInstance(type, result.Count);
result.CopyTo(array, 0);
return array;
}
catch (Exception ex)
{
throw new DataException("Could not perform FindAllStateless for " + type.Name, ex);
}
}
}