Example #1
0
        public static void LoadDomainDataUsers(IRepository<User> userRepository)
        {
            string[] names = { "Scott", "John", "James", "Bob", "Larry", "Joe", "Pete", "Adam", "Alan", "Ken" };
            string[] loginIDs = { "postit", "aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee", "fffff", "ggggg", "hhhhh", "iiiii" };

            //using (var ts = new TransactionScope())
            //{
            NHibernateSessionManager.Instance.BeginTransaction();
            for (int i = 0; i < 10; i++)
            {
                var user = new User
                {
                    Email = "[email protected]",
                    EmployeeID = "999999999",
                    FirstName = names[i],
                    LastName = "Last",
                    LoginID = loginIDs[i],
                    UserKey = Guid.NewGuid()
                };

                userRepository.EnsurePersistent(user); //Save
            }

            NHibernateSessionManager.Instance.CommitTransaction();
        }
Example #2
0
        /// <summary>
        /// Creates the accounts.
        /// </summary>
        /// <param name="accountRepository">The account repository.</param>
        private static void CreateAccounts(IRepository<Account> accountRepository)
        {
            //Create 2 active accounts, 3 inactive
            for (int i = 1; i < 6; i++)
            {
                var account = new Account
                                  {
                                      Name = "Account" + i,
                                  };
                account.IsActive = i%2==0;

                accountRepository.EnsurePersistent(account);
            }
        }