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)
                : this.CreateModelToTableMapperHelper()?.GetMappings().ToDictionary(kvp => kvp.Key.Name, kvp => kvp.Value);
        }
        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);
        }
Exemple #3
0
        protected virtual void CheckMapperValidity(IEnumerable <ColumnInfo> tableColumnsList)
        {
            if (_mapper == null || _mapper.Count() < 1)
            {
                return;
            }

            var dbColumnNames = tableColumnsList.Select(t => t.Name.ToLowerInvariant()).ToList();

            if (_mapper.GetMappings().Select(t => t.Value).Any(mappingColumnName => !dbColumnNames.Contains(mappingColumnName.ToLowerInvariant())))
            {
                throw new ModelToTableMapperException("I cannot find any correspondence between defined ModelToTableMapper properties and database Table columns.");
            }
        }