Пример #1
0
        protected TableDependency(
            string connectionString,
            string schemaName = null,
            string tableName  = null,
            IModelToTableMapper <T> mapper  = null,
            IUpdateOfModel <T> updateOf     = null,
            ITableDependencyFilter filter   = null,
            DmlTriggerType dmlTriggerType   = DmlTriggerType.All,
            bool executeUserPermissionCheck = true)
        {
            if (mapper?.Count() == 0)
            {
                throw new UpdateOfException("mapper parameter is empty.");
            }
            if (updateOf?.Count() == 0)
            {
                throw new UpdateOfException("updateOf parameter is empty.");
            }

            this.CheckIfConnectionStringIsValid(connectionString);
            this.CheckIfParameterlessConstructorExistsForModel();
            if (executeUserPermissionCheck)
            {
                this.CheckIfUserHasPermissions(connectionString);
            }

            _connectionString = connectionString;
            _tableName        = this.GetTableName(tableName);
            _schemaName       = this.GetSchemaName(schemaName);
            _server           = this.GetServerName(connectionString);
            _database         = this.GetDataBaseName(connectionString);

            this.CheckIfTableExists(connectionString);
            this.CheckRdbmsDependentImplementation(connectionString);

            var tableColumnList = this.GetTableColumnsList(connectionString);

            if (!tableColumnList.Any())
            {
                throw new TableWithNoColumnsException(tableName);
            }

            _mapper = mapper ?? this.GetModelMapperFromColumnDataAnnotation();
            this.CheckMapperValidity(tableColumnList);

            this.CheckUpdateOfCongruenceWithTriggerType(updateOf, dmlTriggerType);
            _updateOf = this.GetUpdateOfColumnNameList(updateOf, tableColumnList);

            _userInterestedColumns = this.GetUserInterestedColumns(tableColumnList);
            if (!_userInterestedColumns.Any())
            {
                throw new NoMatchBetweenModelAndTableColumns();
            }
            this.CheckIfUserInterestedColumnsCanBeManaged(_userInterestedColumns);

            _dataBaseObjectsNamingConvention = this.GetBaseObjectsNamingConvention();
            _dmlTriggerType = dmlTriggerType;
            _filter         = filter;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventReactor" /> class.
        /// </summary>
        public EventReactor(
            ITypeMapper mapper,
            IEventSerializer serializer,
            EventStoreOptions options,
            ITableDependencyFilter filter = null) : base(options.ConnectionString, options.EventsTableName, options.SchemaName, filter)
        {
            _typeMapper = mapper;
            _serializer = serializer;
            _options    = options;

            Start();
        }
Пример #3
0
        protected TableDependency(
            string connectionString,
            string tableName              = null,
            string schemaName             = null,
            ITableDependencyFilter filter = null)
        {
            _connectionString = connectionString;

            _tableName  = GetTableName(tableName);
            _schemaName = GetSchemaName(schemaName);
            _server     = GetServerName();
            _database   = GetDataBaseName();

            CheckRdbmsDependentImplementation();

            _dataBaseObjectsNamingConvention = GetBaseObjectsNamingConvention();
            _filter = filter;
        }
 public SqlTableDependencyTest(
     string connectionString,
     string tableName  = null,
     string schemaName = null,
     IModelToTableMapper <T> mapper  = null,
     IUpdateOfModel <T> updateOf     = null,
     ITableDependencyFilter filter   = null,
     DmlTriggerType notifyOn         = DmlTriggerType.All,
     bool executeUserPermissionCheck = true,
     bool includeOldValues           = false,
     bool throwExceptionBeforeWaitForNotifications     = false,
     bool throwExceptionInWaitForNotificationsPoint1   = false,
     bool throwExceptionInWaitForNotificationsPoint2   = false,
     bool throwExceptionInWaitForNotificationsPoint3   = false,
     bool throwExceptionCreateSqlServerDatabaseObjects = false) : base(connectionString, tableName, schemaName, mapper, updateOf, filter, notifyOn, executeUserPermissionCheck, includeOldValues)
 {
     _throwExceptionBeforeWaitForNotifications     = throwExceptionBeforeWaitForNotifications;
     _throwExceptionInWaitForNotificationsPoint1   = throwExceptionInWaitForNotificationsPoint1;
     _throwExceptionInWaitForNotificationsPoint2   = throwExceptionInWaitForNotificationsPoint2;
     _throwExceptionInWaitForNotificationsPoint3   = throwExceptionInWaitForNotificationsPoint3;
     _throwExceptionCreateSqlServerDatabaseObjects = throwExceptionCreateSqlServerDatabaseObjects;
 }
 public SqlTableDependencyWithReconnection(string connectionString, string tableName = null, string schemaName = null, IModelToTableMapper <TEntity> mapper = null, IUpdateOfModel <TEntity> updateOf = null, ITableDependencyFilter filter = null, DmlTriggerType notifyOn = DmlTriggerType.All, bool executeUserPermissionCheck = true, bool includeOldValues = false)
     : base(connectionString, tableName, schemaName, mapper, updateOf, filter, notifyOn, executeUserPermissionCheck, includeOldValues)
 {
 }