Exemplo n.º 1
0
        public IEnumerable <string> Run()
        {
            Database.SetInitializer(new OrtmanFamilyInitializer());
            var context = new FamilyMembersWithConventions();

            context.Database.Delete();
            context.Database.Initialize(true);

            return(Enumerable.Empty <string>());
        }
Exemplo n.º 2
0
        public IEnumerable <string> Run()
        {
            Database.SetInitializer(new OrtmanFamilyInitializer());
            var context = new FamilyMembersWithConventions();

            //since i know i've only just created 1 dad, i just hardcode the ID
            var chris = context.Dads.First(x => x.FirstName == "Chris");

            var clara = new Kid()
            {
                Name = "Clara", Birthday = DateTime.Parse("1/21/2009")
            };

            chris.Kids.Add(clara);

            var message = new Message("Data inserted via conventions demo");

            context.Messages.Add(message);

            context.SaveChanges();
            return(Enumerable.Empty <string>());
        }