static void Main(string[] args) { var builder = new ContainerBuilder(); builder.RegisterType<PhotoArkContext>().As<IPhotoArkContext>(); builder.RegisterType<UserService>().As<IUserService>(); var container = builder.Build(); using (var scope = container.BeginLifetimeScope()) { var ctx = scope.Resolve<IPhotoArkContext>(); IUserService userService = scope.Resolve<IUserService>(); var user = new User() { UserName = "******", Email = "*****@*****.**", UserDetail = new UserDetail() }; var user2 = new User() { UserName = "******", Email = "*****@*****.**", UserDetail = new UserDetail() }; userService.Create(user); } }
public static User CreateNewUser(string email, string userName) { var userDetails = new UserDetail(); var user = new User() { UserName = userName, Email = email, Authenticated = false, AuthenticationString = new Guid(), UserDetail = userDetails, }; return user; }
protected bool Equals(User other) { return string.Equals(UserName, other.UserName, StringComparison.OrdinalIgnoreCase) && string.Equals(Email, other.Email, StringComparison.OrdinalIgnoreCase); }