本文整理汇总了C#中PredicateExpression.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PredicateExpression.Add方法的具体用法?C# PredicateExpression.Add怎么用?C# PredicateExpression.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PredicateExpression
的用法示例。
在下文中一共展示了PredicateExpression.Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public static void Add(int artworkId, int roleId)
{
var entity = new ArtworkToRoleEntity();
entity.ArtworkId = artworkId;
entity.RoleId = roleId;
var filter = new PredicateExpression();
filter.Add(ArtworkToRoleFields.ArtworkId == artworkId);
filter.Add(ArtworkToRoleFields.RoleId == roleId);
Database.AddOrUpdateEntity(entity, filter, false);
}
示例2: GetTodayVisit
public string GetTodayVisit()
{
WebTrackerCollection trackers = new WebTrackerCollection();
PredicateExpression filter = new PredicateExpression();
filter.Add(WebTrackerFields.VisitTime == DateTime.Parse(DateTime.Now.ToShortDateString()));
trackers.GetMulti(filter);
return trackers.Count.ToString();
}
示例3: FilterValidEntities
/// <summary>
/// Returns entites which validityDateTimeField is GREATER OR EQUAL than startDateTime,
/// and LESS than endDateTime.
public static PredicateExpression FilterValidEntities(DateTime? startDateTime,
DateTime? endDateTime,
EntityField2 validityDateTimeField)
{
PredicateExpression predicateExpression = new PredicateExpression();
if (null != startDateTime)
{
predicateExpression.Add(validityDateTimeField >= startDateTime.Value);
}
if (null != endDateTime)
{
predicateExpression.Add(validityDateTimeField < endDateTime.Value);
}
return predicateExpression;
}
示例4: GetMainCategories
public CategoryCollection GetMainCategories()
{
CategoryCollection categories = new CategoryCollection();
PredicateExpression filter = new PredicateExpression();
filter.Add(new FieldCompareNullPredicate(CategoryFields.BaseCategoryId));
categories.GetMulti(filter);
return categories;
}
示例5: GetMultiUsingRolesWithAuditAction
/// <summary>Retrieves in the calling AuditActionCollection object all AuditActionEntity objects which are related via a relation of type 'm:n' with the passed in RoleEntity.</summary>
/// <param name="containingTransaction">A containing transaction, if caller is added to a transaction, or null if not.</param>
/// <param name="collectionToFill">Collection to fill with the entity objects retrieved</param>
/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query. When set to 0, no limitations are specified.</param>
/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
/// <param name="entityFactoryToUse">The EntityFactory to use when creating entity objects during a GetMulti() call.</param>
/// <param name="roleInstance">RoleEntity object to be used as a filter in the m:n relation</param>
/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch.</param>
/// <param name="pageNumber">The page number to retrieve.</param>
/// <param name="pageSize">The page size of the page to retrieve.</param>
/// <returns>true if succeeded, false otherwise</returns>
public bool GetMultiUsingRolesWithAuditAction(ITransaction containingTransaction, IEntityCollection collectionToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IEntity roleInstance, IPrefetchPath prefetchPathToUse, int pageNumber, int pageSize)
{
RelationCollection relations = new RelationCollection();
relations.Add(AuditActionEntity.Relations.RoleAuditActionEntityUsingAuditActionID, "RoleAuditAction_");
relations.Add(RoleAuditActionEntity.Relations.RoleEntityUsingRoleID, "RoleAuditAction_", string.Empty, JoinHint.None);
IPredicateExpression selectFilter = new PredicateExpression();
selectFilter.Add(new FieldCompareValuePredicate(roleInstance.Fields[(int)RoleFieldIndex.RoleID], ComparisonOperator.Equal));
return this.GetMulti(containingTransaction, collectionToFill, maxNumberOfItemsToReturn, sortClauses, entityFactoryToUse, selectFilter, relations, prefetchPathToUse, pageNumber, pageSize);
}
示例6: CreatePredicate
public IPredicateExpression CreatePredicate(ConcurrencyPredicateType predicateTypeToCreate, object containingEntity)
{
IPredicateExpression toReturn = null;
if ((_doTriggerOnSave && predicateTypeToCreate == ConcurrencyPredicateType.Save) ||
(_doTriggerOnDelete && predicateTypeToCreate == ConcurrencyPredicateType.Delete))
{
toReturn = new PredicateExpression();
IEntity2 entity = (IEntity2)containingEntity;
EntityField2 concurrencyField = (EntityField2)entity.Fields[_concurrencyFieldName];
toReturn.Add(concurrencyField == concurrencyField.CurrentValue);
}
return toReturn;
}