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

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