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>();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        protected BaseService()
        {
            var db = new BullsAndCowsDbContext();

            this.Users = new GenericRepository <User>(db);
        }
Beispiel #5
0
 public Users()
 {
     this.data = new BullsAndCowsData(BullsAndCowsDbContext.Create());
 }
Beispiel #6
0
 public UsersService()
 {
     this.data = new UsersData(BullsAndCowsDbContext.Create());
 }
 protected BaseService()
 {
     var db = new BullsAndCowsDbContext();
     this.Users = new GenericRepository<User>(db);
 }
Beispiel #8
0
 public static void Initialize()
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion <BullsAndCowsDbContext, Configuration>());
     BullsAndCowsDbContext.Create().Database.Initialize(true);
 }
Beispiel #9
0
 public Repository(BullsAndCowsDbContext context)
 {
     this.context = context;
     this.set     = context.Set <T>();
 }