コード例 #1
0
ファイル: Configuration.cs プロジェクト: Moiraines/WebNews
 protected override void Seed(CrowdSourcedNewsDbContext context)
 {
     context.Categories.AddOrUpdate(
         c => c.Name,
         new Category {
         Name = "Sports"
     },
         new Category {
         Name = "Politics"
     },
         new Category {
         Name = "Food"
     },
         new Category {
         Name = "International"
     },
         new Category {
         Name = "Local"
     },
         new Category {
         Name = "Business"
     },
         new Category {
         Name = "Economy"
     },
         new Category {
         Name = "Education"
     },
         new Category {
         Name = "Health"
     },
         new Category {
         Name = "Celebrity"
     });
 }
コード例 #2
0
 public static void Initialize()
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion <CrowdSourcedNewsDbContext, Configuration>());
     CrowdSourcedNewsDbContext.Create().Database.Initialize(true);
 }