예제 #1
0
 private static void ResetDatabase()
 {
     using (var db = new PhotoShareContext())
     {
         db.Database.EnsureDeleted();
         db.Database.EnsureCreated();
         new DbSeeder(db).SeedTestData();
     }
 }
예제 #2
0
 private static void ResetDatabase()
 {
     using (var db = new PhotoShareContext())
     {
         db.Database.EnsureDeleted();
         db.Database.EnsureCreated();
         InitialData.Seed(db);
     }
 }
        private static void ResetDatabase()
        {
            PhotoShareContext context = new PhotoShareContext();

            using (context)
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
            }
        }
        public static void Main()
        {
            ResetDatabase();
            CommandDispatcher commandDispatcher = new CommandDispatcher();
            PhotoShareContext context           = new PhotoShareContext();

            using (context)
            {
                Engine engine = new Engine(commandDispatcher, context);
                engine.Run();
            }
        }
예제 #5
0
        static void Main()
        {
            var                context           = new PhotoShareContext();
            DbSet <User>       users             = context.Users;
            DbSet <Album>      albums            = context.Albums;
            DbSet <Picture>    pictures          = context.Pictures;
            DbSet <Tag>        tags              = context.Tags;
            DbSet <AlbumRole>  albumRoles        = context.AlbumRoles;
            DbSet <Town>       towns             = context.Towns;
            ICommandDispatcher commandDispatcher = new CommandDispatcher(context, users, albums, pictures, tags, albumRoles, towns);
            IReader            reader            = new ConsoleReader();
            IWriter            writer            = new ConsoleWriter();
            IRunnable          engine            = new Engine(commandDispatcher, reader, writer);

            engine.Run("start");
        }
예제 #6
0
        public static void Main()
        {
            var context = new PhotoShareContext();

            var unit             = new UnitOfWork(context);
            var userService      = new UserService(unit);
            var townService      = new TownService(unit);
            var albumService     = new AlbumService(unit);
            var albumRoleService = new AlbumRoleService(unit);
            var tagService       = new TagService(unit);
            var pictureService   = new PictureService(unit);

            ICommandDispatcher commandDispatcher = new CommandDispatcher(userService, albumService, pictureService, tagService, albumRoleService, townService);

            IReader reader = new ConsoleReader();
            IWriter writer = new ConsoleWriter();

            IRunnable engine = new Engine(commandDispatcher, reader, writer);

            engine.Run();
        }