本文整理汇总了C#中IDataAccess.Find方法的典型用法代码示例。如果您正苦于以下问题:C# IDataAccess.Find方法的具体用法?C# IDataAccess.Find怎么用?C# IDataAccess.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataAccess
的用法示例。
在下文中一共展示了IDataAccess.Find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUser
internal static User GetUser(IDataAccess dataAccess, int userId)
{
if(dataAccess == null)
throw new ArgumentNullException("dataAccess");
var user = new UserEntity();
var oql = OQL.From(user).Select().Where(p => p.Property(user.UserId) == userId).End();
user = dataAccess.Find<UserEntity>(oql);
return Mapper.Map<UserEntity, User>(user);
}
示例2: GetUserId
public static bool GetUserId(IDataAccess dataAccess, string identity, string @namespace, out int userId)
{
if(dataAccess == null)
throw new ArgumentNullException("dataAccess");
if(string.IsNullOrWhiteSpace(identity))
throw new ArgumentNullException("identity");
var entity = new UserEntity();
var oql = new OQL(entity);
var comparer = new Comparer(oql);
comparer = GetUserIdentityComparer(identity, @namespace, comparer, entity);
oql = oql.Select(entity.UserId)
.Where(comparer)
.End();
entity = dataAccess.Find<UserEntity>(oql);
var result = entity != null && entity.UserId > 0;
userId = 0;
if(result)
userId = entity.UserId;
return result;
}
示例3: GetPasswordCore
private static int? GetPasswordCore(IDataAccess dataAccess, Comparer comparer, UserEntity entity, out byte[] password, out byte[] passwordSalt, out bool isApproved, out bool isSuspended)
{
if(dataAccess == null)
throw new ArgumentNullException("dataAccess");
if(Object.Equals(comparer, null))
throw new ArgumentNullException("comparer");
password = null;
passwordSalt = null;
isApproved = false;
isSuspended = false;
var oql = comparer.OQL
.Select(entity.UserId, entity.Password, entity.PasswordSalt, entity.Approved, entity.Suspended)
.Where(comparer)
.End();
entity = dataAccess.Find<UserEntity>(oql);
if(entity == null)
return null;
password = entity.Password;
passwordSalt = entity.PasswordSalt;
isApproved = entity.Approved;
isSuspended = entity.Suspended;
return entity.UserId;
}