public static void Initialize(GarbContext context)
        {
            context.Database.EnsureCreated();

            if (context.Locales.Any())
            {
                return;   // DB has been seeded
            }

            //var projects = new Project[]
            //{
            //    new Project{ProjectName="Velocity"},
            //    new Project{ProjectName="Test2"},
            //    new Project{ProjectName="BE"},
            //};

            //foreach (Project p in projects)
            //{
            //    context.Projects.Add(p);
            //}
            //context.SaveChanges();


            //var builds = new Build[] {
            //    new Build{ProjectName="Velocity", BuildName = "1.0"},
            //    new Build{ProjectName="Test2", BuildName = "2.2"}
            //};

            //foreach (Build b in builds)
            //{
            //    context.Builds.Add(b);
            //}
            //context.SaveChanges();

            var locales = new Locale[] {
                new Locale {
                    LocaleCode = "en-US", LocaleName = "English (United States)"
                },
                new Locale {
                    LocaleCode = "pl-PL", LocaleName = "Polish"
                },
                new Locale {
                    LocaleCode = "ja-JP", LocaleName = "Japanese"
                },
                new Locale {
                    LocaleCode = "de-DE", LocaleName = "German"
                },
                new Locale {
                    LocaleCode = "zh-CN", LocaleName = "Simplified Chinese"
                },
                new Locale {
                    LocaleCode = "zh-TW", LocaleName = "Traditional Chinese"
                }
            };

            foreach (Locale l in locales)
            {
                context.Locales.Add(l);
            }
            context.SaveChanges();
        }
Beispiel #2
0
 public int Save(string userName = null)
 {
     return(_context.SaveChanges(userName));
 }