protected TableDependency(
            string connectionString,
            string tableName  = null,
            string schemaName = 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.");
            }

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

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

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

            var tableColumnList = this.GetTableColumnsList();

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

            _mapper = mapper ?? ModelToTableMapperHelper <T> .GetModelMapperFromColumnDataAnnotation(tableColumnList);

            this.CheckMapperValidity(tableColumnList);

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

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

            _dataBaseObjectsNamingConvention = this.GetBaseObjectsNamingConvention();
            _dmlTriggerType = dmlTriggerType;
            _filter         = filter;
        }
        public SqlTableDependencyFilter(Expression filter, IModelToTableMapper <T> modelMapperDictionary = null)
        {
            _filter = filter;

            _modelMapperDictionary = modelMapperDictionary != null && modelMapperDictionary.Count() > 0
                ? modelMapperDictionary.GetMappings().ToDictionary(kvp => kvp.Key.Name, kvp => kvp.Value)
                : ModelToTableMapperHelper <T> .GetModelMapperFromColumnDataAnnotation()?.GetMappings().ToDictionary(kvp => kvp.Key.Name, kvp => kvp.Value);
        }