本文整理汇总了C#中PredicateExpression类的典型用法代码示例。如果您正苦于以下问题:C# PredicateExpression类的具体用法?C# PredicateExpression怎么用?C# PredicateExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PredicateExpression类属于命名空间,在下文中一共展示了PredicateExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetByEvent
public IList<Auction.Domain.Raffle> GetByEvent(long eventId,
ref IAuctionTransaction trans)
{
using (var records = new RaffleCollection())
{
var filter = new PredicateExpression(RaffleFields.EventId == eventId);
if (trans != null)
{
trans.Add(records);
}
records.GetMulti(filter);
return records.Select(
r =>
new Raffle()
{
CreatedBy = r.CreatedBy,
EventId = r.EventId,
Id = r.Id,
Name = r.Name,
Revenue = r.Total,
UpdatedBy = (long) r.UpdatedBy
}).ToList();
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:25,代码来源:RaffleRepository.cs
示例2: Add
public static int Add(int seriesId, int season)
{
var entity = new SeasonEntity { SeasonNumber = season, SeriesId = seriesId };
var filter = new PredicateExpression { SeasonFields.SeriesId == seriesId, SeasonFields.SeasonNumber == season };
return Database.AddOrUpdateEntity(entity, filter, false).SeasonId;
}
开发者ID:MichelZ,项目名称:TVJunkie,代码行数:7,代码来源:SeasonEntity.cs
示例3: HasStream
public static bool HasStream(int fileId)
{
var filter = new PredicateExpression { FileVideoStreamFields.FileId == fileId };
var entity = Database.GetEntityCollection<FileVideoStreamEntity>(new RelationPredicateBucket(filter));
return entity.Any();
}
开发者ID:MichelZ,项目名称:TVJunkie,代码行数:7,代码来源:FileVideoStreamEntity.cs
示例4: HasEpisodeAttached
public static bool HasEpisodeAttached(int fileId)
{
var filter = new PredicateExpression { EpisodeToFileFields.FileId == fileId };
var entity = Database.GetEntityCollection<EpisodeToFileEntity>(new RelationPredicateBucket(filter));
return entity.Any();
}
开发者ID:MichelZ,项目名称:TVJunkie,代码行数:7,代码来源:FileEntity.cs
示例5: ProviderQueryExpression
public ProviderQueryExpression(
IEnumerable<ProviderPropertyExpression> providerProperties,
ProjectionExpression projection,
PredicateExpression predicate,
SortExpressionCollectionExpression sort)
: this(new ProviderPropertiesExpression(providerProperties), projection, predicate, sort)
{ }
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:7,代码来源:ProviderQueryExpression.cs
示例6: Get
public Auction.Domain.Package Get(long Id, ref IAuctionTransaction trans)
{
using (var records = new PackageCollection())
{
var filter = new PredicateExpression(PackageFields.Id == Id);
if (trans != null)
{
trans.Add(records);
}
records.GetMulti(filter, 1);
var r = records.FirstOrDefault();
return new Package()
{
BidderId = r.BidderId,
CategoryId = r.CategoryId,
ClosedOutBy = r.ClosedOutBy,
Code = r.Code,
CreatedBy = r.CreatedBy,
EndingBid = r.EndingBid,
EventId = r.EventId,
Id = r.Id,
Name = r.Name,
Notes = r.Notes,
Paid = (bool) r.Paid,
StartingBid = r.StartingBid,
UpdatedBy = r.UpdatedBy
};
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:29,代码来源:PackageRepository.cs
示例7: GetByCategory
public IList<Auction.Domain.Package> GetByCategory(long categoryId,
ref IAuctionTransaction trans)
{
using (var records = new PackageCollection())
{
var filter = new PredicateExpression(PackageFields.CategoryId == categoryId);
if (trans != null)
{
trans.Add(records);
}
records.GetMulti(filter);
return records.Select(r => new Package()
{
BidderId = r.BidderId,
CategoryId = r.CategoryId,
ClosedOutBy = r.ClosedOutBy,
Code = r.Code,
CreatedBy = r.CreatedBy,
EndingBid = r.EndingBid,
EventId = r.EventId,
Id = r.Id,
Name = r.Name,
Notes = r.Notes,
Paid = (bool)r.Paid,
StartingBid = r.StartingBid,
UpdatedBy = r.UpdatedBy
}).ToList();
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:29,代码来源:PackageRepository.cs
示例8: GetByAccount
public IList<Auction.Domain.Event> GetByAccount(long accountId,
ref IAuctionTransaction trans)
{
using (var records = new AuctionEventCollection())
{
var filter = new PredicateExpression(AuctionEventFields.AccountId == accountId);
if (trans != null)
{
trans.Add(records);
}
records.GetMulti(filter, 0);
return
records.Select(
b =>
new Event()
{
Id = b.Id,
Date = b.Date,
Name = b.Name,
AccountId = b.AccountId,
CreatedBy = b.CreatedBy,
Locked = b.Locked,
Notes = b.Notes,
UpdatedBy = b.UpdatedBy
}).ToList();
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:27,代码来源:EventRepository.cs
示例9: Get
public Event Get(long Id, ref IAuctionTransaction trans)
{
using (var records = new AuctionEventCollection())
{
var filter = new PredicateExpression(AuctionEventFields.Id == Id);
if (trans != null)
{
trans.Add(records);
}
records.GetMulti(filter, 1);
var b = records.ToList().FirstOrDefault();
return new Event()
{
Id = Id,
Date = b.Date,
Name = b.Name,
AccountId = b.AccountId,
CreatedBy = b.CreatedBy,
Locked = b.Locked,
Notes = b.Notes,
UpdatedBy = b.UpdatedBy
};
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:25,代码来源:EventRepository.cs
示例10: 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();
}
开发者ID:fahrigoktuna,项目名称:ProductSearchEngine,代码行数:8,代码来源:WebTrackerAdapter.cs
示例11: DoSearch
/// <summary>
/// Does the search using MS Full text search
/// </summary>
/// <param name="searchString">Search string.</param>
/// <param name="forumIDs">Forum Ids of forums to search into.</param>
/// <param name="orderFirstElement">Order first element setting.</param>
/// <param name="orderSecondElement">Order second element setting.</param>
/// <param name="forumsWithThreadsFromOthers">The forums with threads from others.</param>
/// <param name="userID">The userid of the calling user.</param>
/// <param name="targetToSearch">The target to search.</param>
/// <returns>
/// TypedList filled with threads matching the query.
/// </returns>
public static SearchResultTypedList DoSearch(string searchString, List<int> forumIDs, SearchResultsOrderSetting orderFirstElement,
SearchResultsOrderSetting orderSecondElement, List<int> forumsWithThreadsFromOthers, int userID, SearchTarget targetToSearch)
{
// the search utilizes full text search. It performs a CONTAINS upon the MessageText field of the Message entity.
string searchTerms = PrepareSearchTerms(searchString);
bool searchMessageText = (targetToSearch == SearchTarget.MessageText) || (targetToSearch == SearchTarget.MessageTextAndThreadSubject);
bool searchSubject = (targetToSearch == SearchTarget.ThreadSubject) || (targetToSearch == SearchTarget.MessageTextAndThreadSubject);
if(!(searchSubject || searchMessageText))
{
// no target specified, select message
searchMessageText = true;
}
PredicateExpression searchTermFilter = new PredicateExpression();
if(searchMessageText)
{
// Message contents filter
searchTermFilter.Add(new FieldCompareSetPredicate(ThreadFields.ThreadID, MessageFields.ThreadID,
SetOperator.In, new FieldFullTextSearchPredicate(MessageFields.MessageText, FullTextSearchOperator.Contains, searchTerms)));
}
if(searchSubject)
{
// Thread subject filter
if(searchMessageText)
{
searchTermFilter.AddWithOr(new FieldFullTextSearchPredicate(ThreadFields.Subject, FullTextSearchOperator.Contains, searchTerms));
}
else
{
searchTermFilter.Add(new FieldFullTextSearchPredicate(ThreadFields.Subject, FullTextSearchOperator.Contains, searchTerms));
}
}
IPredicateExpression mainFilter = searchTermFilter
.And(ForumFields.ForumID == forumIDs)
.And(ThreadGuiHelper.CreateThreadFilter(forumsWithThreadsFromOthers, userID));
ISortExpression sorter = new SortExpression();
// add first element
sorter.Add(CreateSearchSortClause(orderFirstElement));
if(orderSecondElement != orderFirstElement)
{
sorter.Add(CreateSearchSortClause(orderSecondElement));
}
SearchResultTypedList results = new SearchResultTypedList(false);
try
{
// get the data from the db.
results.Fill(500, sorter, false, mainFilter);
}
catch
{
// probably an error with the search words / user error. Swallow for now, which will result in an empty resultset.
}
return results;
}
开发者ID:priaonehaha,项目名称:HnD,代码行数:71,代码来源:Searcher.cs
示例12: 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);
}
开发者ID:priaonehaha,项目名称:HnD,代码行数:20,代码来源:AuditActionDAO.cs
示例13: GetMainCategories
public CategoryCollection GetMainCategories()
{
CategoryCollection categories = new CategoryCollection();
PredicateExpression filter = new PredicateExpression();
filter.Add(new FieldCompareNullPredicate(CategoryFields.BaseCategoryId));
categories.GetMulti(filter);
return categories;
}
开发者ID:fahrigoktuna,项目名称:ProductSearchEngine,代码行数:9,代码来源:CategoryAdapter.cs
示例14: FilterValidEntities
/// <summary>
/// Returns valid entities which are valid for given moment in time.
/// Valid entities have:
/// 1. Begining is not NULL AND is LESS than given moment in time.
/// 2. End is NULL OR is GREATER OR EQUAL than given moment in time.
/// </summary>
public static PredicateExpression FilterValidEntities(DateTime momentInTime,
EntityField2 validFromDateTimeField,
EntityField2 validToDateTimeField)
{
PredicateExpression predicateExpression = new PredicateExpression();
predicateExpression.Add(validFromDateTimeField != DBNull.Value & validFromDateTimeField <= momentInTime);
predicateExpression.AddWithAnd(validToDateTimeField == DBNull.Value | validToDateTimeField >= momentInTime);
return predicateExpression;
}
开发者ID:malininja,项目名称:NinjaSoftware.Helpers,代码行数:16,代码来源:PredicateHelper.cs
示例15: 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);
}
开发者ID:MichelZ,项目名称:TVJunkie,代码行数:11,代码来源:ArtworkToRoleEntity.cs
示例16: Delete
public void Delete(long Id, ref IAuctionTransaction trans)
{
using (var records = new CategoryCollection())
{
var filter = new PredicateExpression(CategoryFields.Id == Id);
if (trans != null)
{
trans.Add(records);
}
records.DeleteMulti(filter);
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:12,代码来源:CategoryRepository.cs
示例17: EventExists
public bool EventExists(long id, ref IAuctionTransaction trans)
{
using (var records = new AuctionEventCollection())
{
var filter = new PredicateExpression(AuctionEventFields.Id == id);
if (trans != null)
{
trans.Add(records);
}
return records.GetDbCount(filter) > 0;
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:12,代码来源:EventRepository.cs
示例18: GetMember
public MembershipEntity GetMember(string uName, string password)
{
MembershipCollection memberships = new MembershipCollection();
PredicateExpression filter = new PredicateExpression();
filter.AddWithAnd(MembershipFields.UserName == uName);
filter.AddWithAnd(MembershipFields.Password == Business.Encryption.SHA1Encryption.EncryptMessage(password));
filter.AddWithAnd(MembershipFields.Status == true);
memberships.GetMulti(filter);
if (memberships.Count > 0)
return memberships.FirstOrDefault();
else
return null;
}
开发者ID:fahrigoktuna,项目名称:ProductSearchEngine,代码行数:13,代码来源:MemberShipAdapter.cs
示例19: subjectAttributes
public SelectList subjectAttributes(object selObjId)
{
if (m_subjectAttributes == null)
{
m_subjectAttributes = new AttributeCollection();
RelationCollection rels = new RelationCollection(AttributeEntity.Relations.ContextEntityUsingContextId);
PredicateExpression pe = new PredicateExpression(ContextFields.Name == "subject");
SortExpression se = new SortExpression(AttributeFields.Name | SortOperator.Ascending);
m_subjectAttributes.GetMulti(pe, 0, se, rels);
}
SelectList selList = new SelectList(m_subjectAttributes, "Id", "Name", selObjId);
return selList;
}
开发者ID:habibvirji,项目名称:Webinos-Platform,代码行数:14,代码来源:baseData.cs
示例20: GetByAccount
public IList<Category> GetByAccount(long accountId, ref IAuctionTransaction trans)
{
using (var records = new CategoryCollection())
{
var filter = new PredicateExpression(CategoryFields.AccountId == accountId);
if (trans != null)
{
trans.Add(records);
}
records.GetMulti(filter, 0);
return records.ToList().Select(c => new Category() { Id = c.Id, Name = c.Name, AccountId = c.AccountId }).ToList();
}
}
开发者ID:danappleyard,项目名称:auction-csharp,代码行数:14,代码来源:CategoryRepository.cs
注:本文中的PredicateExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论