Ejemplo n.º 1
0
        private void Initialize()
        {
            var propBindingInfo = Parser.GetModelPropertyStrategy();

            if (propBindingInfo == null && Parser.GetPropertyInfo() == null)
            {
                throw new InvalidOperationException("UNABLE_DETERMINE_PARAMETER_TYPE");
            }

            DbPropertyStrategy = propBindingInfo;
            MapProperty        = (DbPropertyStrategy != null)
                ? DbPropertyStrategy.GetPropertyInfo()
                : Parser.GetPropertyInfo();

            var propertyType = MapProperty.PropertyType;

            if (propertyType != typeof(string) &&
                propertyType != typeof(DBNull) &&
                propertyType.IsNullable())
            {
                propertyType = Nullable.GetUnderlyingType(propertyType);
            }

            MapPropertyType = propertyType;
        }
Ejemplo n.º 2
0
        private void AddOrReplacePropertyBindingInfo(string propertyName, IDbModelPropertyStrategy modelPropertyStrategy)
        {
            if (_modelPropertyBindings.Any(c => c.GetPropertyInfo().Name == propertyName))
            {
                _modelPropertyBindings.Remove(_modelPropertyBindings.First(c => c.GetPropertyInfo().Name == propertyName));
            }

            _modelPropertyBindings.Add(modelPropertyStrategy);
        }
Ejemplo n.º 3
0
 private void AddOrReplaceParameterBindingInfo(string parameterName, IDbModelPropertyStrategy modelPropertyBindingInfo)
 {
     if (_dbProcParamsBindingInfo.ContainsKey(parameterName))
     {
         _dbProcParamsBindingInfo[parameterName] = modelPropertyBindingInfo;
     }
     else
     {
         _dbProcParamsBindingInfo.Add(parameterName, modelPropertyBindingInfo);
     }
 }
Ejemplo n.º 4
0
 private void AddOrReplaceParameterBindingInfo(string parameterName, IDbModelPropertyStrategy parameterBindingInfo)
 {
     if (_modelPropertyStrategies.ContainsKey(parameterName))
     {
         _modelPropertyStrategies[parameterName] = parameterBindingInfo;
     }
     else
     {
         _modelPropertyStrategies.Add(parameterName, parameterBindingInfo);
     }
 }
Ejemplo n.º 5
0
 public DbParameterParser(IDbModelPropertyStrategy modelPropertyStrategy)
 {
     NodeStart = null;
     this.ModelPropertyStrategy = modelPropertyStrategy;
     Initialize();
 }