public MetricsDeliveryManager(Guid serviceInstanceID, Dictionary <string, EdgeType> edgeTypes = null, MetricsDeliveryManagerOptions options = null)
            : base(serviceInstanceID)
        {
            options = options ?? new MetricsDeliveryManagerOptions();
            options.StagingConnectionString = options.StagingConnectionString ?? AppSettings.GetConnectionString(this, Consts.ConnectionStrings.Staging);
            options.CommitConnectionString  = options.CommitConnectionString ?? AppSettings.GetConnectionString(this, Consts.ConnectionStrings.DataWarehouse);
            options.ObjectsConnectionString = options.CommitConnectionString ?? AppSettings.GetConnectionString(this, Consts.ConnectionStrings.Objects);

            options.SqlTransformCommand = options.SqlTransformCommand ?? AppSettings.Get(this, Consts.AppSettings.SqlTransformCommand, throwException: false);
            options.SqlStageCommand     = options.SqlStageCommand ?? AppSettings.Get(this, Consts.AppSettings.SqlStageCommand, throwException: false);
            options.SqlCommitCommand    = options.SqlStageCommand ?? AppSettings.Get(this, Consts.AppSettings.SqlCommitCommand, throwException: false);
            options.SqlRollbackCommand  = options.SqlRollbackCommand ?? AppSettings.Get(this, Consts.AppSettings.SqlRollbackCommand, throwException: false);

            Options = options;

            // create connection and table managers
            _deliverySqlConnection = OpenDbConnection(Consts.ConnectionStrings.Deliveries);
            _objectsSqlConnection  = OpenDbConnection(Consts.ConnectionStrings.Objects);

            _edgeObjectsManager = new EdgeObjectsManager(_deliverySqlConnection, _objectsSqlConnection)
            {
                EdgeTypes = edgeTypes
            };
            _metricsTableManager = new MetricsTableManager(_deliverySqlConnection, _edgeObjectsManager)
            {
                EdgeTypes = edgeTypes
            };
        }
Пример #2
0
 public MetricsTableManager(SqlConnection connection, EdgeObjectsManager edgeObjectsManager)
 {
     _deliverySqlConnection = connection;
     _edgeObjectsManger     = edgeObjectsManager;
     _insertMetricsCommand  = new SqlCommand {
         Connection = _deliverySqlConnection
     };
 }