示例#1
0
        protected override void Seed(ThaContext context)
        {
            // Seed code goes here...
            var dkLan = new Language {
                Country = "Denmark", ISO = "DK"
            };
            var usLan = new Language {
                Country = "USA", ISO = "US"
            };
            var enLan = new Language {
                Country = "Britain", ISO = "EN"
            };

            context.Languages.Add(dkLan);
            context.Languages.Add(usLan);
            context.Languages.Add(enLan);

            var firstTextDK = new TextLanguage {
                Language    = dkLan,
                Description = "Smølfer er blå",
                Title       = "Smølferne"
            };
            var firstTextUS = new TextLanguage {
                Language    = usLan,
                Description = "Smurfs are Blue",
                Title       = "Smurfs"
            };
            var firstTextEN = new TextLanguage {
                Language    = enLan,
                Description = "Smurfs are Blue, and a Cup of TEA",
                Title       = "Smurfs, and a Cup of TEA"
            };

            var smurfText = new Text()
            {
                Languages = new List <TextLanguage> {
                    firstTextDK, firstTextUS, firstTextEN
                }
            };

            context.Texts.Add(smurfText);

            context.GlobalGoals.Add(new GlobalGoal()
            {
                Translation = smurfText
            });

            context.SaveChanges();
            base.Seed(context);
        }
示例#2
0
 public override void InitializeDatabase(ThaContext context)
 {
     base.InitializeDatabase(context);
 }