Exemple #1
0
        public Program([NotNull] IApplicationEnvironment appEnv)
        {
            Check.NotNull(appEnv, "appEnv");

            _projectDir    = appEnv.ApplicationBasePath;
            _rootNamespace = appEnv.ApplicationName;

            var assemblyName = new AssemblyName(appEnv.ApplicationName);
            var assembly     = Assembly.Load(assemblyName);

            _migrationTool = new MigrationTool(assembly);
        }
        public Program([NotNull] IApplicationEnvironment appEnv)
        {
            Check.NotNull(appEnv, "appEnv");

            _projectDir    = appEnv.ApplicationBasePath;
            _rootNamespace = appEnv.ApplicationName;

            var loggerProvider = new LoggerProvider(name => new ConsoleCommandLogger(name, verbose: true));
            var assemblyName   = new AssemblyName(appEnv.ApplicationName);
            var assembly       = Assembly.Load(assemblyName);

            _migrationTool = new MigrationTool(loggerProvider, assembly);
        }
        static void Main(string[] args)
        {
            var loggr = new ConsoleLoggerProvider((p, q)=>String.IsNullOrWhiteSpace(p) && ((int)q) > 4);
            var assmbly = typeof(Program).Assembly;
            var mig = new MigrationTool(loggr, typeof(Program).Assembly);

            mig.AddMigration(
                           $"{DateTimeOffset.Now.Ticks}",
                           nameof(SampleContext),
                           nameof(assmbly), "consoleEf7", @"C:\git\consoleEf7\consoleEf7"); /*
            if (args[1] == "migrator")
            {

                switch((MigrationPaths)Enum.Parse(typeof(MigrationPaths), args[2]))
                {
                    case MigrationPaths.Add:
                        mig.AddMigration(
                            args[3] ?? $"{DateTimeOffset.Now.Ticks}",
                            nameof(SampleContext),
                            nameof(assmbly), "consoleEf7", @"C:\git\consoleEf7\consoleEf7");

                        break;

                    case MigrationPaths.Apply:

                        break;

                    case MigrationPaths.Remove:

                        break;

                    case MigrationPaths.Rollback:

                        break;

                    case MigrationPaths.Idempotent:

                        break;

                    default:

                        break;

                }
            }                                                                                 */
            Console.WriteLine("Success for Ef7!");

            Console.ReadLine();
        }
        public Executor([NotNull] IDictionary args)
        {
            Check.NotNull(args, "args");

            // TODO: Pass in targetPath
            var targetDir      = (string)args["targetDir"];
            var targetFileName = (string)args["targetFileName"];
            var targetPath     = Path.Combine(targetDir, targetFileName);

            _projectDir    = (string)args["projectDir"];
            _rootNamespace = (string)args["rootNamespace"];

            var assemblyName = AssemblyName.GetAssemblyName(targetPath);
            var assembly     = Assembly.Load(assemblyName);

            _migrationTool = new MigrationTool(assembly);
        }
Exemple #5
0
        public Program([NotNull] IServiceProvider serviceProvider,
            [NotNull] IApplicationEnvironment appEnv, [NotNull] ILibraryManager libraryManager)
        {
            Check.NotNull(serviceProvider, nameof(serviceProvider));
            Check.NotNull(appEnv, nameof(appEnv));
            Check.NotNull(libraryManager, nameof(libraryManager));

            _projectDir = appEnv.ApplicationBasePath;
            _rootNamespace = appEnv.ApplicationName;

            var loggerProvider = new LoggerProvider(name => new ConsoleCommandLogger(name, verbose: true));
            var assemblyName = new AssemblyName(appEnv.ApplicationName);
            var assembly = Assembly.Load(assemblyName);
            _migrationTool = new MigrationTool(loggerProvider, assembly);
            _databaseTool = new DatabaseTool(serviceProvider, loggerProvider);
            _libraryManager = libraryManager;
        }
Exemple #6
0
        public Program([NotNull] IServiceProvider serviceProvider,
                       [NotNull] IApplicationEnvironment appEnv, [NotNull] ILibraryManager libraryManager)
        {
            Check.NotNull(serviceProvider, nameof(serviceProvider));
            Check.NotNull(appEnv, nameof(appEnv));
            Check.NotNull(libraryManager, nameof(libraryManager));

            _projectDir    = appEnv.ApplicationBasePath;
            _rootNamespace = appEnv.ApplicationName;

            var loggerProvider = new LoggerProvider(name => new ConsoleCommandLogger(name, verbose: true));
            var assemblyName   = new AssemblyName(appEnv.ApplicationName);
            var assembly       = Assembly.Load(assemblyName);

            _migrationTool  = new MigrationTool(loggerProvider, assembly);
            _databaseTool   = new DatabaseTool(serviceProvider, loggerProvider);
            _libraryManager = libraryManager;
        }
Exemple #7
0
        public Executor([NotNull] object logHandler, [NotNull] IDictionary args)
        {
            Check.NotNull(logHandler, "logHandler");
            Check.NotNull(args, "args");

            var unwrappedLogHandler = logHandler as ILogHandler
                                      ?? new ForwardingProxy <ILogHandler>(logHandler).GetTransparentProxy();
            var loggerProvider = new LoggerProvider(name => new CommandLoggerAdapter(name, unwrappedLogHandler));

            var targetPath = (string)args["targetPath"];

            _projectDir    = (string)args["projectDir"];
            _rootNamespace = (string)args["rootNamespace"];

            var assemblyName = AssemblyName.GetAssemblyName(targetPath);
            var assembly     = Assembly.Load(assemblyName);

            _migrationTool = new MigrationTool(loggerProvider, assembly);
        }
        public Program([NotNull] IServiceProvider serviceProvider,
            [NotNull] IApplicationEnvironment appEnv, [NotNull] ILibraryManager libraryManager,
            [NotNull] IRuntimeEnvironment runtimeEnv, [NotNull] IApplicationShutdown applicationShutdown)
        {
            Check.NotNull(serviceProvider, nameof(serviceProvider));
            Check.NotNull(appEnv, nameof(appEnv));
            Check.NotNull(libraryManager, nameof(libraryManager));
            Check.NotNull(runtimeEnv, nameof(runtimeEnv));
            Check.NotNull(applicationShutdown, nameof(applicationShutdown));

            _runtimeEnv = runtimeEnv;
            _projectDir = appEnv.ApplicationBasePath;
            _rootNamespace = appEnv.ApplicationName;
            _applicationShutdown = applicationShutdown;

            var loggerProvider = new LoggerProvider(name => new ConsoleCommandLogger(name, verbose: true));
            var assemblyName = new AssemblyName(appEnv.ApplicationName);
            var assembly = Assembly.Load(assemblyName);
            _migrationTool = new MigrationTool(loggerProvider, assembly, serviceProvider);
            _databaseTool = new DatabaseTool(serviceProvider, loggerProvider);
            _libraryManager = libraryManager;
            _logger = loggerProvider.CreateLogger(typeof(Program).FullName);
        }
Exemple #9
0
        public Program([NotNull] IServiceProvider serviceProvider,
                       [NotNull] IApplicationEnvironment appEnv, [NotNull] ILibraryManager libraryManager,
                       [NotNull] IRuntimeEnvironment runtimeEnv, [NotNull] IApplicationShutdown applicationShutdown)
        {
            Check.NotNull(serviceProvider, nameof(serviceProvider));
            Check.NotNull(appEnv, nameof(appEnv));
            Check.NotNull(libraryManager, nameof(libraryManager));
            Check.NotNull(runtimeEnv, nameof(runtimeEnv));
            Check.NotNull(applicationShutdown, nameof(applicationShutdown));

            _runtimeEnv          = runtimeEnv;
            _projectDir          = appEnv.ApplicationBasePath;
            _rootNamespace       = appEnv.ApplicationName;
            _applicationShutdown = applicationShutdown;

            var loggerProvider = new LoggerProvider(name => new ConsoleCommandLogger(name, verbose: true));
            var assemblyName   = new AssemblyName(appEnv.ApplicationName);
            var assembly       = Assembly.Load(assemblyName);

            _migrationTool  = new MigrationTool(loggerProvider, assembly, serviceProvider);
            _databaseTool   = new DatabaseTool(serviceProvider, loggerProvider);
            _libraryManager = libraryManager;
            _logger         = loggerProvider.CreateLogger(typeof(Program).FullName);
        }