本文整理汇总了C#中IUserRepository.CreateUser方法的典型用法代码示例。如果您正苦于以下问题:C# IUserRepository.CreateUser方法的具体用法?C# IUserRepository.CreateUser怎么用?C# IUserRepository.CreateUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUserRepository
的用法示例。
在下文中一共展示了IUserRepository.CreateUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanInsertEmployee
public void CanInsertEmployee()
{
using (_session = NHibernateSessionManager.GetSession())
{
_employeeRepository = new EmployeeRepository(
new Repository<Employee>(_session)
);
_userRepository = new UserRepository(
new Repository<User>(_session)
);
using (var transaction = _session.BeginTransaction())
{
var john = new Employee()
{
FirstName = "Johny",
LastName = "Doe",
BirthDate = new DateTime(1989, 12, 08),
Gender = Gender.Male,
HomeAddress = new Address("California", "90210", "Chill Rd.")
};
var johnAsUser = new User("mynameisjohnymamba", "mypassword", john);
var newEmployee = _employeeRepository.RegisterEmployee(john);
var newUser = _userRepository.CreateUser(johnAsUser);
transaction.Commit();
}}
}
示例2: CreateTestUser
private static void CreateTestUser(IUserRepository userRepository)
{
Console.Write("Creating user {0}...", UserName);
userRepository.CreateUser(UserName, Password, "[email protected]", "YouTrack.REST");
Console.WriteLine("done.");
}