예제 #1
0
        public static void Initialize(BankSystemContext context)
        {
            context.Database.EnsureCreated();

            if (context.Users.Any())
            {
                return;   // DB has been seeded
            }
            var users = new List <User>();

            for (int i = 0; i < 10; i++)
            {
                var user =
                    new User
                {
                    ID            = Guid.NewGuid(),
                    AccountNumber = Guid.NewGuid(),
                    AccountName   = "user " + i,
                    Balance       = 1000 * i,
                    Password      = "******" + i,
                    CreatedDate   = DateTime.Now
                };
                users.Add(user);
            }

            context.Users.AddRange(users);
            context.SaveChanges();
        }
예제 #2
0
 public static void Initialize(BankSystemContext context)
 {
     context.Database.EnsureCreated();
 }