当前位置: 首页>>代码示例>>C#>>正文


C# IDataAccess.Select方法代码示例

本文整理汇总了C#中IDataAccess.Select方法的典型用法代码示例。如果您正苦于以下问题:C# IDataAccess.Select方法的具体用法?C# IDataAccess.Select怎么用?C# IDataAccess.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataAccess的用法示例。


在下文中一共展示了IDataAccess.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetUser

		public static User GetUser(IDataAccess dataAccess, int userId)
		{
			if(dataAccess == null)
				throw new ArgumentNullException("dataAccess");

			return dataAccess.Select<User>(DATA_ENTITY_USER, new Condition("UserId", userId)).FirstOrDefault();
		}
开发者ID:dbabox,项目名称:Zongsoft.Security,代码行数:7,代码来源:MembershipHelper.cs

示例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 conditions = MembershipHelper.GetUserIdentityConditions(identity, @namespace);
			var record = dataAccess.Select<IDictionary<string, object>>(MembershipHelper.DATA_ENTITY_USER, conditions, "!, UserId").FirstOrDefault();
			var result = record != null && record.Count > 0 && record.ContainsKey("UserId");

			userId = 0;

			if(result)
				userId = Zongsoft.Common.Convert.ConvertValue<int>(record["UserId"]);

			return result;
		}
开发者ID:dbabox,项目名称:Zongsoft.Security,代码行数:19,代码来源:MembershipHelper.cs

示例3: GetPasswordCore

		private static int? GetPasswordCore(IDataAccess dataAccess, ICondition condition, out byte[] password, out byte[] passwordSalt, out bool isApproved, out bool isSuspended)
		{
			if(dataAccess == null)
				throw new ArgumentNullException("dataAccess");

			if(condition == null)
				throw new ArgumentNullException("condition");

			password = null;
			passwordSalt = null;
			isApproved = false;
			isSuspended = false;

			//从数据引擎中获取指定条件的用户密码数据
			var dictionary = dataAccess.Select<IDictionary<string, object>>(MembershipHelper.DATA_ENTITY_USER, condition, "!, UserId, Password, PasswordSalt, Approved, Suspended").FirstOrDefault();

			if(dictionary == null || dictionary.Count < 1)
				return null;

			object value;

			if(dictionary.TryGetValue("Approved", out value))
				isApproved = Zongsoft.Common.Convert.ConvertValue<bool>(value);

			if(dictionary.TryGetValue("Suspended", out value))
				isSuspended = Zongsoft.Common.Convert.ConvertValue<bool>(value);

			object storedPassword;
			object storedPasswordSalt;

			dictionary.TryGetValue("Password", out storedPassword);
			dictionary.TryGetValue("PasswordSalt", out storedPasswordSalt);

			password = storedPassword as byte[];
			passwordSalt = storedPasswordSalt as byte[];

			object result;

			if(dictionary.TryGetValue("UserId", out result))
				return Zongsoft.Common.Convert.ConvertValue<int?>(result, () => null);

			return null;
		}
开发者ID:dbabox,项目名称:Zongsoft.Security,代码行数:43,代码来源:MembershipHelper.cs


注:本文中的IDataAccess.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。