public static void Main() { using (var db = new BullsAndCowsDbContext()) { } }
public EfGenericRepository(BullsAndCowsDbContext context) { if (context == null) { throw new ArgumentException("An instance of DbContext is required to use this repository.", "context"); } this.Context = context; this.DbSet = this.Context.Set <T>(); }
protected override void Seed(BullsAndCowsDbContext context) { if (!(context.Users.Any(u => u.UserName == "typhon"))) { var userStore = new UserStore <User>(context); var userManager = new UserManager <User>(userStore); var userToInsert = new User { UserName = "******", Email = "*****@*****.**" }; userManager.Create(userToInsert, "nanana"); } context.SaveChanges(); }
protected BaseService() { var db = new BullsAndCowsDbContext(); this.Users = new GenericRepository <User>(db); }
public Users() { this.data = new BullsAndCowsData(BullsAndCowsDbContext.Create()); }
public UsersService() { this.data = new UsersData(BullsAndCowsDbContext.Create()); }
protected BaseService() { var db = new BullsAndCowsDbContext(); this.Users = new GenericRepository<User>(db); }
public static void Initialize() { Database.SetInitializer(new MigrateDatabaseToLatestVersion <BullsAndCowsDbContext, Configuration>()); BullsAndCowsDbContext.Create().Database.Initialize(true); }
public Repository(BullsAndCowsDbContext context) { this.context = context; this.set = context.Set <T>(); }