Beispiel #1
0
        public IDecorationCommand Instantiate(IDataEngineeringCommandArgs args, IDbConnection connection)
        {
            if (!(connection is SqlConnection) || connection == null)
            {
                throw new ArgumentException(nameof(connection));
            }

            switch (args)
            {
            case ILoadCommandArgs loadArgs: return(new BulkLoadCommand(loadArgs));

            case IResetCommandArgs resetArgs: return(new TruncateCommand(resetArgs));

            case IBatchRunCommandArgs batchRunArgs: return(new BatchRunCommand(batchRunArgs));

            default: throw new ArgumentException();
            }
        }
Beispiel #2
0
        public IDecorationCommand Instantiate(IDataEngineeringCommandArgs args)
        {
            switch (args)
            {
            case IConnectionWaitCommandArgs connectionWaitArgs: return(new ConnectionWaitCommand(connectionWaitArgs));

            case IEtlRunCommandArgs etlRunArgs: return(new EtlRunCommand(etlRunArgs));

            default:
            {
                var sessionFactory = new ClientProvider();
                var connection     = sessionFactory.Instantiate(args.ConnectionString).CreateNew() as IDbConnection;

                switch (connection)
                {
                case SqlConnection sqlConnection: return(new SqlServerDataEngineeringFactory().Instantiate(args, sqlConnection));

                default: throw new ArgumentException();
                }
            }
            }
        }