Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var uofFactory = new UofFactory();


            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", true, true)
                                    .Build();

            var folderPath = config.GetValue <string>("folderpath");

            while (true)
            {
                Console.WriteLine("Что желаете? '1' - миграция БД MS SQL, '2' - миграция БД SQLite, '3' - миграция БД PostgreSQL, '4' - миграция БД MySQL");

                ConsoleKeyInfo info = Console.ReadKey();

                switch (info.KeyChar)
                {
                case '1':
                {
                    var(uof, db, options) = uofFactory.GetMSSqlUnitOfWork(config);
                    Migrate(uof, db, options, folderPath, config);
                }
                break;

                case '2':
                {
                    var(uof, db, options) = uofFactory.GetSQLiteUnitOfWork(config);
                    Migrate(uof, db, options, folderPath, config);
                }
                break;

                case '3':
                {
                    var(uof, db, options) = uofFactory.GetPostgreSQLUnitOfWork(config);
                    Migrate(uof, db, options, folderPath, config);
                }
                break;

                case '4':
                {
                    var(uof, db, options) = uofFactory.GetMySQLUnitOfWork(config);
                    Migrate(uof, db, options, folderPath, config);
                }
                break;
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            var uofFactory = new UofFactory(configuration);

            //try
            //{
            //var container = new RegisterByContainer().Container;

            //var unitOfWork = container.GetInstance<IUnitOfWork>();

            while (true)
            {
                Console.WriteLine("Что желаете? '1' - миграция БД MS SQL, '2' - миграция БД SQLite, '3' - миграция БД PostgreSQL, '4' - миграция БД MySQL");

                ConsoleKeyInfo info = Console.ReadKey();

                Task task = null;

                switch (info.KeyChar)
                {
                case '1':
                {
                    var(uof, options) = uofFactory.GetMSSqlUnitOfWork();
                    task = Migrate(uof, options, configuration);
                }
                break;

                case '2':
                {
                    var(uof, options) = uofFactory.GetSQLiteUnitOfWork();
                    task = Migrate(uof, options, configuration);
                }
                break;

                case '3':
                {
                    var(uof, options) = uofFactory.GetPostgreSQLUnitOfWork();
                    task = Migrate(uof, options, configuration);
                }
                break;

                case '4':
                {
                    var(uof, options) = uofFactory.GetMySQLUnitOfWork();
                    task = Migrate(uof, options, configuration);
                }
                break;
                }

                if (task != null)
                {
                    task.Wait();
                }
            }


            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.ToString());
            //}


            //FillDB(unitOfWork);

            //unitOfWork.Commit();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var uofFactory = new UofFactory();
            //try
            //{
            //var container = new RegisterByContainer().Container;

            //var unitOfWork = container.GetInstance<IUnitOfWork>();

            var folderPath = Properties.Settings.Default.FolderPath;

            while (true)
            {
                Console.WriteLine("Что желаете? '1' - миграция БД MS SQL, '2' - миграция БД SQLite, '3' - миграция БД PostgreSQL, '4' - миграция БД MySQL");

                ConsoleKeyInfo info = Console.ReadKey();

                switch (info.KeyChar)
                {
                case '1':
                {
                    var(uof, db, options) = uofFactory.GetMSSqlUnitOfWork();
                    Migrate(uof, db, options, folderPath);
                }
                break;

                case '2':
                {
                    var(uof, db, options) = uofFactory.GetSQLiteUnitOfWork();
                    Migrate(uof, db, options, folderPath);
                }
                break;

                case '3':
                {
                    var(uof, db, options) = uofFactory.GetPostgreSQLUnitOfWork();
                    Migrate(uof, db, options, folderPath);
                }
                break;

                case '4':
                {
                    var(uof, db, options) = uofFactory.GetMySQLUnitOfWork();
                    Migrate(uof, db, options, folderPath);
                }
                break;
                }
            }


            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.ToString());
            //}


            //FillDB(unitOfWork);

            //unitOfWork.Commit();
        }