本文整理汇总了C#中DataAccess.Get方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.Get方法的具体用法?C# DataAccess.Get怎么用?C# DataAccess.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess.Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Creates this instance.
/// </summary>
/// <remarks></remarks>
public void Create()
{
var db = new DataAccess();
var existingRole = db.Get<Role>(RoleName);
if (existingRole != null)
throw new Exception("A role with that name already exists.");
db.Insert(RoleName,this);
}
示例2: GetUserByEmailAddress
/// <summary>
/// Gets the user by email address.
/// </summary>
/// <param name="emailAddress">The email address.</param>
/// <returns></returns>
/// <remarks></remarks>
public static User GetUserByEmailAddress(string emailAddress)
{
var db = new DataAccess();
return db.Get<User>(emailAddress);
}
示例3: Create
/// <summary>
/// Creates this instance.
/// </summary>
/// <remarks></remarks>
public void Create()
{
/*
* First check to see if a user with the same e-mail address exists
* if a user exists throw an exception.
*/
var db = new DataAccess();
var existingUser = db.Get<User>(EMailAddress);
if (existingUser != null)
{
throw new Exception("User with this e-mail address already exists.");
}
db.Insert(EMailAddress, this);
}