Advertisement
Guest User

Untitled

a guest
Oct 28th, 2015
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. internal sealed class Configuration : DbMigrationsConfiguration<Bookmarks.Data.BookmarksContext>
  2.     {
  3.         public Configuration()
  4.         {
  5.             AutomaticMigrationsEnabled = true;
  6.             ContextKey = "Bookmarks.Data.BookmarksContext";
  7.         }
  8.  
  9.         protected override void Seed(Bookmarks.Data.BookmarksContext context)
  10.         {
  11.             if (context.Bookmarks.Any())
  12.             {
  13.                 return;
  14.             }
  15.  
  16.             var pesho = new User()
  17.             {
  18.                 UserName = "pesho@goshov.com",
  19.                 Email = "pesho@goshov.com"
  20.             };
  21.             var gosho = new User()
  22.             {
  23.                 UserName = "gosho@peshev.com",
  24.                 Email = "gosho@peshev.com"
  25.             };
  26.             var userManager = new UserManager<User>(new UserStore<User>(context));
  27.             userManager.Create(pesho, "123");
  28.             userManager.Create(gosho, "123");
  29.  
  30.             context.SaveChanges();
  31.         }
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement