本文整理汇总了C#中ContainmentOperator类的典型用法代码示例。如果您正苦于以下问题:C# ContainmentOperator类的具体用法?C# ContainmentOperator怎么用?C# ContainmentOperator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContainmentOperator类属于命名空间,在下文中一共展示了ContainmentOperator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ByItemId
public static IQueryable<PetShop.Core.Data.Inventory> ByItemId(this IQueryable<PetShop.Core.Data.Inventory> queryable, ContainmentOperator containmentOperator, string itemId)
{
if (itemId == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("itemId", "Parameter 'itemId' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(i => i.ItemId.Contains(itemId));
case ContainmentOperator.StartsWith:
return queryable.Where(i => i.ItemId.StartsWith(itemId));
case ContainmentOperator.EndsWith:
return queryable.Where(i => i.ItemId.EndsWith(itemId));
case ContainmentOperator.NotContains:
return queryable.Where(i => i.ItemId.Contains(itemId) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(i => i.ItemId != itemId);
default:
return queryable.Where(i => i.ItemId == itemId);
}
}
示例2: ByCategoryId
public static IQueryable<Petshop.Data.Entities.Category> ByCategoryId(this IQueryable<Petshop.Data.Entities.Category> queryable, ContainmentOperator containmentOperator, System.String categoryId)
{
if (categoryId == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("categoryId", "Parameter 'categoryId' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(c => c.CategoryId.Contains(categoryId));
case ContainmentOperator.StartsWith:
return queryable.Where(c => c.CategoryId.StartsWith(categoryId));
case ContainmentOperator.EndsWith:
return queryable.Where(c => c.CategoryId.EndsWith(categoryId));
case ContainmentOperator.NotContains:
return queryable.Where(c => c.CategoryId.Contains(categoryId) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(c => c.CategoryId != categoryId);
default:
return queryable.Where(c => c.CategoryId == categoryId);
}
}
示例3: ByDescn
public static IQueryable<PetShop.Core.Data.Product> ByDescn(this IQueryable<PetShop.Core.Data.Product> queryable, ContainmentOperator containmentOperator, string descn)
{
if (descn == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("descn", "Parameter 'descn' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(p => p.Descn.Contains(descn));
case ContainmentOperator.StartsWith:
return queryable.Where(p => p.Descn.StartsWith(descn));
case ContainmentOperator.EndsWith:
return queryable.Where(p => p.Descn.EndsWith(descn));
case ContainmentOperator.NotContains:
return queryable.Where(p => p.Descn.Contains(descn) == false);
case ContainmentOperator.NotEquals:
return descn == null
? queryable.Where(p => p.Descn != null)
: queryable.Where(p => p.Descn != descn);
default:
return descn == null
? queryable.Where(p => p.Descn == null)
: queryable.Where(p => p.Descn == descn);
}
}
示例4: ByUsername
public static IQueryable<Tracker.Data.Entities.Audit> ByUsername(this IQueryable<Tracker.Data.Entities.Audit> queryable, ContainmentOperator containmentOperator, System.String username)
{
if (username == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("username", "Parameter 'username' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(a => a.Username.Contains(username));
case ContainmentOperator.StartsWith:
return queryable.Where(a => a.Username.StartsWith(username));
case ContainmentOperator.EndsWith:
return queryable.Where(a => a.Username.EndsWith(username));
case ContainmentOperator.NotContains:
return queryable.Where(a => a.Username.Contains(username) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(a => a.Username != username);
default:
return queryable.Where(a => a.Username == username);
}
}
示例5: ByBillState
public static IQueryable<PetShop.Core.Data.Order> ByBillState(this IQueryable<PetShop.Core.Data.Order> queryable, ContainmentOperator containmentOperator, string billState)
{
if (billState == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("billState", "Parameter 'billState' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(o => o.BillState.Contains(billState));
case ContainmentOperator.StartsWith:
return queryable.Where(o => o.BillState.StartsWith(billState));
case ContainmentOperator.EndsWith:
return queryable.Where(o => o.BillState.EndsWith(billState));
case ContainmentOperator.NotContains:
return queryable.Where(o => o.BillState.Contains(billState) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(o => o.BillState != billState);
default:
return queryable.Where(o => o.BillState == billState);
}
}
示例6: ByBillCity
public static IQueryable<Petshop.Data.Entities.Order> ByBillCity(this IQueryable<Petshop.Data.Entities.Order> queryable, ContainmentOperator containmentOperator, System.String billCity)
{
if (billCity == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("billCity", "Parameter 'billCity' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(o => o.BillCity.Contains(billCity));
case ContainmentOperator.StartsWith:
return queryable.Where(o => o.BillCity.StartsWith(billCity));
case ContainmentOperator.EndsWith:
return queryable.Where(o => o.BillCity.EndsWith(billCity));
case ContainmentOperator.NotContains:
return queryable.Where(o => o.BillCity.Contains(billCity) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(o => o.BillCity != billCity);
default:
return queryable.Where(o => o.BillCity == billCity);
}
}
示例7: ByLocale
public static IQueryable<Petshop.Data.Entities.Order> ByLocale(this IQueryable<Petshop.Data.Entities.Order> queryable, ContainmentOperator containmentOperator, System.String locale)
{
if (locale == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("locale", "Parameter 'locale' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(o => o.Locale.Contains(locale));
case ContainmentOperator.StartsWith:
return queryable.Where(o => o.Locale.StartsWith(locale));
case ContainmentOperator.EndsWith:
return queryable.Where(o => o.Locale.EndsWith(locale));
case ContainmentOperator.NotContains:
return queryable.Where(o => o.Locale.Contains(locale) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(o => o.Locale != locale);
default:
return queryable.Where(o => o.Locale == locale);
}
}
示例8: ByPhone
public static IQueryable<PetShop.Core.Data.Supplier> ByPhone(this IQueryable<PetShop.Core.Data.Supplier> queryable, ContainmentOperator containmentOperator, string phone)
{
if (phone == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("phone", "Parameter 'phone' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(s => s.Phone.Contains(phone));
case ContainmentOperator.StartsWith:
return queryable.Where(s => s.Phone.StartsWith(phone));
case ContainmentOperator.EndsWith:
return queryable.Where(s => s.Phone.EndsWith(phone));
case ContainmentOperator.NotContains:
return queryable.Where(s => s.Phone.Contains(phone) == false);
case ContainmentOperator.NotEquals:
return phone == null
? queryable.Where(s => s.Phone != null)
: queryable.Where(s => s.Phone != phone);
default:
return phone == null
? queryable.Where(s => s.Phone == null)
: queryable.Where(s => s.Phone == phone);
}
}
示例9: ByStatus
public static IQueryable<Tracker.Data.Entities.TaskDetail> ByStatus(this IQueryable<Tracker.Data.Entities.TaskDetail> queryable, ContainmentOperator containmentOperator, System.String status)
{
if (status == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("status", "Parameter 'status' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(t => t.Status.Contains(status));
case ContainmentOperator.StartsWith:
return queryable.Where(t => t.Status.StartsWith(status));
case ContainmentOperator.EndsWith:
return queryable.Where(t => t.Status.EndsWith(status));
case ContainmentOperator.NotContains:
return queryable.Where(t => t.Status.Contains(status) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(t => t.Status != status);
default:
return queryable.Where(t => t.Status == status);
}
}
示例10: ByPriority
public static IQueryable<Tracker.Data.Entities.TaskDetail> ByPriority(this IQueryable<Tracker.Data.Entities.TaskDetail> queryable, ContainmentOperator containmentOperator, System.String priority)
{
if (priority == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("priority", "Parameter 'priority' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(t => t.Priority.Contains(priority));
case ContainmentOperator.StartsWith:
return queryable.Where(t => t.Priority.StartsWith(priority));
case ContainmentOperator.EndsWith:
return queryable.Where(t => t.Priority.EndsWith(priority));
case ContainmentOperator.NotContains:
return queryable.Where(t => t.Priority.Contains(priority) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(t => t.Priority != priority);
default:
return queryable.Where(t => t.Priority == priority);
}
}
示例11: ByName
public static IQueryable<Petshop.Data.Entities.Product> ByName(this IQueryable<Petshop.Data.Entities.Product> queryable, ContainmentOperator containmentOperator, System.String name)
{
if (name == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("name", "Parameter 'name' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(p => p.Name.Contains(name));
case ContainmentOperator.StartsWith:
return queryable.Where(p => p.Name.StartsWith(name));
case ContainmentOperator.EndsWith:
return queryable.Where(p => p.Name.EndsWith(name));
case ContainmentOperator.NotContains:
return queryable.Where(p => p.Name.Contains(name) == false);
case ContainmentOperator.NotEquals:
return name == null
? queryable.Where(p => p.Name != null)
: queryable.Where(p => p.Name != name);
default:
return name == null
? queryable.Where(p => p.Name == null)
: queryable.Where(p => p.Name == name);
}
}
示例12: ByComment
public static IQueryable<Tracker.Core.Data.User> ByComment(this IQueryable<Tracker.Core.Data.User> queryable, ContainmentOperator containmentOperator, string comment)
{
if (comment == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("comment", "Parameter 'comment' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(u => u.Comment.Contains(comment));
case ContainmentOperator.StartsWith:
return queryable.Where(u => u.Comment.StartsWith(comment));
case ContainmentOperator.EndsWith:
return queryable.Where(u => u.Comment.EndsWith(comment));
case ContainmentOperator.NotContains:
return queryable.Where(u => u.Comment.Contains(comment) == false);
case ContainmentOperator.NotEquals:
return comment == null
? queryable.Where(u => u.Comment != null)
: queryable.Where(u => u.Comment != comment);
default:
return comment == null
? queryable.Where(u => u.Comment == null)
: queryable.Where(u => u.Comment == comment);
}
}
示例13: ByPasswordHash
public static IQueryable<Tracker.Core.Data.User> ByPasswordHash(this IQueryable<Tracker.Core.Data.User> queryable, ContainmentOperator containmentOperator, string passwordHash)
{
if (passwordHash == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("passwordHash", "Parameter 'passwordHash' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(u => u.PasswordHash.Contains(passwordHash));
case ContainmentOperator.StartsWith:
return queryable.Where(u => u.PasswordHash.StartsWith(passwordHash));
case ContainmentOperator.EndsWith:
return queryable.Where(u => u.PasswordHash.EndsWith(passwordHash));
case ContainmentOperator.NotContains:
return queryable.Where(u => u.PasswordHash.Contains(passwordHash) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(u => u.PasswordHash != passwordHash);
default:
return queryable.Where(u => u.PasswordHash == passwordHash);
}
}
示例14: ByEmailAddress
public static IQueryable<Tracker.Core.Data.User> ByEmailAddress(this IQueryable<Tracker.Core.Data.User> queryable, ContainmentOperator containmentOperator, string emailAddress)
{
if (emailAddress == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("emailAddress", "Parameter 'emailAddress' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(u => u.EmailAddress.Contains(emailAddress));
case ContainmentOperator.StartsWith:
return queryable.Where(u => u.EmailAddress.StartsWith(emailAddress));
case ContainmentOperator.EndsWith:
return queryable.Where(u => u.EmailAddress.EndsWith(emailAddress));
case ContainmentOperator.NotContains:
return queryable.Where(u => u.EmailAddress.Contains(emailAddress) == false);
case ContainmentOperator.NotEquals:
return queryable.Where(u => u.EmailAddress != emailAddress);
default:
return queryable.Where(u => u.EmailAddress == emailAddress);
}
}
示例15: ByAvatarType
public static IQueryable<Tracker.Core.Data.User> ByAvatarType(this IQueryable<Tracker.Core.Data.User> queryable, ContainmentOperator containmentOperator, string avatarType)
{
if (avatarType == null && containmentOperator != ContainmentOperator.Equals && containmentOperator != ContainmentOperator.NotEquals)
throw new ArgumentNullException("avatarType", "Parameter 'avatarType' cannot be null with the specified ContainmentOperator. Parameter 'containmentOperator' must be ContainmentOperator.Equals or ContainmentOperator.NotEquals to support null.");
switch (containmentOperator)
{
case ContainmentOperator.Contains:
return queryable.Where(u => u.AvatarType.Contains(avatarType));
case ContainmentOperator.StartsWith:
return queryable.Where(u => u.AvatarType.StartsWith(avatarType));
case ContainmentOperator.EndsWith:
return queryable.Where(u => u.AvatarType.EndsWith(avatarType));
case ContainmentOperator.NotContains:
return queryable.Where(u => u.AvatarType.Contains(avatarType) == false);
case ContainmentOperator.NotEquals:
return avatarType == null
? queryable.Where(u => u.AvatarType != null)
: queryable.Where(u => u.AvatarType != avatarType);
default:
return avatarType == null
? queryable.Where(u => u.AvatarType == null)
: queryable.Where(u => u.AvatarType == avatarType);
}
}