Exemplo n.º 1
0
        private static IGstoreDb NewRepository(string userName)
        {
            //get setting for repositorysource and create repository
            switch (RepositoryProvider())
            {
            case RepositoryProviderEnum.EntityFrameworkCodeFirstProvider:
                return(new EntityFrameworkCodeFirstProvider.GStoreEFDbContext(userName));

            case RepositoryProviderEnum.ListProvider:
                //note ListProvider uses a single static list, no copies or real separate contexts
                _listDb = new ListProvider.ListContext();
                SeedDataExtensions.AddSeedData(_listDb);
                return(_listDb);

            //allow for other repositories, perhaps by class or project name; and config mapping here
            //Example: pull in a provider that takes some lists, some ef, some web services, some whoknowswhats
            default:
                break;
            }

            throw new ApplicationException("Unable to create repository:" + RepositoryProvider().ToString());
        }
Exemplo n.º 2
0
 protected override void Seed(EntityFrameworkCodeFirstProvider.GStoreEFDbContext context)
 {
     SeedDataExtensions.AddSeedData(context);
 }
 protected override void Seed(GStoreEFDbContext context)
 {
     SeedDataExtensions.AddSeedData(context.GStoreDb);
     base.Seed(context);
 }
Exemplo n.º 4
0
 public static void SeedDatabase(this IGstoreDb db, bool force = false)
 {
     SeedDataExtensions.AddSeedData(db, force);
 }