Exemple #1
0
        public void GO()
        {
            using (var db = new BloggingContext())
            {
                db.Blogs.RemoveRange(db.Blogs);
                db.Users.RemoveRange(db.Users);
                db.Posts.RemoveRange(db.Posts);
                var count = db.SaveChanges();
                Console.WriteLine("{0} records removed from database", count);

                //db.Users.Add(user);
                //db.Blogs.Add(blog);

                //db.Posts.Add(ModelGen.DummyPost());

                db.Users.AddRange(ModelGen.Users());

                count = db.SaveChanges();

                this.users = (from s in db.Users select s).ToList();

                Console.WriteLine("{0} records saved to database", count);
            }
        }
Exemple #2
0
        public static List <User> Users()
        {
            ModelGen mg = new ModelGen();

            return(mg.usersGen());
        }