コード例 #1
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="config">Configuration Values</param>
        public Synchronizer(IConfigValues config)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }

            var sqlSchemaReader = new SchemaReader(config.SqlConnection);
            var executor        = new Executor(new SqlConnection(config.SqlConnection));

            this.direction = config.Direction;

            switch (config.Direction)
            {
            case Direction.TableToSql:
                this.tableReader = new TableStorageReader(new AzureStorageResources(config.StorageAccountConnection), config.StorageTableName);
                this.sqlWriter   = new SqlDataWriter(sqlSchemaReader, executor, config.SqlTableName);
                break;

            case Direction.SqlToTable:
                this.sqlReader   = new SqlDataReader(executor, sqlSchemaReader, new DynamicLoader(), config.SqlTableName);
                this.tableWriter = new TableStorageWriter(new TableStorage(config.StorageTableName, config.StorageAccountConnection));
                break;

            default:
                throw new ArgumentException("Invalid Direction.");
            }
        }
コード例 #2
0
ファイル: Synchronizer.cs プロジェクト: jefking/King.B-Trak
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="config">Configuration Values</param>
        public Synchronizer(IConfigValues config)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }

            var sqlSchemaReader = new SchemaReader(config.SqlConnection);
            var executor = new Executor(new SqlConnection(config.SqlConnection));
            this.direction = config.Direction;

            switch (config.Direction)
            {
                case Direction.TableToSql:
                    this.tableReader = new TableStorageReader(new AzureStorageResources(config.StorageAccountConnection), config.StorageTableName);
                    this.sqlWriter = new SqlDataWriter(sqlSchemaReader, executor, config.SqlTableName);
                    break;
                case Direction.SqlToTable:
                    this.sqlReader = new SqlDataReader(executor, sqlSchemaReader, new DynamicLoader(), config.SqlTableName);
                    this.tableWriter = new TableStorageWriter(new TableStorage(config.StorageTableName, config.StorageAccountConnection));
                    break;
                default:
                    throw new ArgumentException("Invalid Direction.");
            }
        }