public void Initialize(ConfigurationScope configScope, ConstructorInfo constructorInfo)
 {
     ParameterInfo[] parameters = constructorInfo.GetParameters();
     for (int i = 0; i < parameters.Length; i++)
     {
         if (parameters[i].Name == this._argumentName)
         {
             this._argumentType = parameters[i].ParameterType;
             break;
         }
     }
     if ((base.CallBackName != null) && (base.CallBackName.Length > 0))
     {
         configScope.ErrorContext.MoreInfo = "Argument property (" + this._argumentName + "), check the typeHandler attribute '" + base.CallBackName + "' (must be a ITypeHandlerCallback implementation).";
         try
         {
             ITypeHandlerCallback callback = (ITypeHandlerCallback)Activator.CreateInstance(configScope.SqlMapper.TypeHandlerFactory.GetType(base.CallBackName));
             base.TypeHandler = new CustomTypeHandler(callback);
             return;
         }
         catch (Exception exception)
         {
             throw new ConfigurationErrorsException("Error occurred during custom type handler configuration.  Cause: " + exception.Message, exception);
         }
     }
     configScope.ErrorContext.MoreInfo = "Argument property (" + this._argumentName + ") set the typeHandler attribute.";
     base.TypeHandler = this.ResolveTypeHandler(configScope, this._argumentType, base.CLRType, base.DbType);
 }
 public void Initialize(IScope scope, Type parameterClass)
 {
     if (this._directionAttribute.Length > 0)
     {
         this._direction = (ParameterDirection)Enum.Parse(typeof(ParameterDirection), this._directionAttribute, true);
     }
     if ((!typeof(IDictionary).IsAssignableFrom(parameterClass) && (parameterClass != null)) && !scope.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(parameterClass))
     {
         if (!this._isComplexMemberName)
         {
             this._getAccessor = scope.DataExchangeFactory.AccessorFactory.GetAccessorFactory.CreateGetAccessor(parameterClass, this._propertyName);
         }
         else
         {
             string name                = this._propertyName.Substring(this._propertyName.LastIndexOf('.') + 1);
             string memberName          = this._propertyName.Substring(0, this._propertyName.LastIndexOf('.'));
             Type   memberTypeForGetter = ObjectProbe.GetMemberTypeForGetter(parameterClass, memberName);
             this._getAccessor = scope.DataExchangeFactory.AccessorFactory.GetAccessorFactory.CreateGetAccessor(memberTypeForGetter, name);
         }
     }
     scope.ErrorContext.MoreInfo = "Check the parameter mapping typeHandler attribute '" + this.CallBackName + "' (must be a ITypeHandlerCallback implementation).";
     if (this.CallBackName.Length > 0)
     {
         try
         {
             ITypeHandlerCallback callback = (ITypeHandlerCallback)Activator.CreateInstance(scope.DataExchangeFactory.TypeHandlerFactory.GetType(this.CallBackName));
             this._typeHandler = new CustomTypeHandler(callback);
             return;
         }
         catch (Exception exception)
         {
             throw new ConfigurationException("Error occurred during custom type handler configuration.  Cause: " + exception.Message, exception);
         }
     }
     if (this.CLRType.Length == 0)
     {
         if ((this._getAccessor != null) && scope.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(this._getAccessor.MemberType))
         {
             this._typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(this._getAccessor.MemberType, this._dbType);
         }
         else
         {
             this._typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetUnkownTypeHandler();
         }
     }
     else
     {
         Type type = TypeUtils.ResolveType(this.CLRType);
         if (scope.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(type))
         {
             this._typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(type, this._dbType);
         }
         else
         {
             type = ObjectProbe.GetMemberTypeForGetter(type, this.PropertyName);
             this._typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(type, this._dbType);
         }
     }
 }
        /// <summary>
        /// Initialize the argument property.
        /// </summary>
        /// <param name="constructorInfo"></param>
        /// <param name="configScope"></param>
        public void Initialize(ConfigurationScope configScope, ConstructorInfo constructorInfo)
        {
            // Search argument by his name to set his type
            ParameterInfo[] parameters = constructorInfo.GetParameters();

            bool found = false;

            for (int i = 0; i < parameters.Length; i++)
            {
                found = (parameters[i].Name == _argumentName);
                if (found)
                {
                    _argumentType = parameters[i].ParameterType;
                    break;
                }
            }
            if (this.CallBackName != null && this.CallBackName.Length > 0)
            {
                configScope.ErrorContext.MoreInfo = "Argument property (" + _argumentName + "), check the typeHandler attribute '" + this.CallBackName + "' (must be a ITypeHandlerCallback implementation).";
                try
                {
                    Type type = configScope.SqlMapper.TypeHandlerFactory.GetType(this.CallBackName);
                    ITypeHandlerCallback typeHandlerCallback = (ITypeHandlerCallback)Activator.CreateInstance(type);
                    this.TypeHandler = new CustomTypeHandler(typeHandlerCallback);
                }
                catch (Exception e)
                {
#if dotnet2
                    throw new ConfigurationErrorsException("Error occurred during custom type handler configuration.  Cause: " + e.Message, e);
#else
                    throw new ConfigurationException("Error occurred during custom type handler configuration.  Cause: " + e.Message, e);
#endif
                }
            }
            else
            {
                configScope.ErrorContext.MoreInfo = "Argument property (" + _argumentName + ") set the typeHandler attribute.";
                this.TypeHandler = this.ResolveTypeHandler(configScope, _argumentType, this.CLRType, this.DbType);
            }
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParameterProperty"/> class.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="callBackName">Name of the call back.</param>
        /// <param name="clrType">Type of the CLR.</param>
        /// <param name="dbType">Type of the db.</param>
        /// <param name="directionAttribute">The direction attribute.</param>
        /// <param name="nullValue">The null value.</param>
        /// <param name="precision">The precision.</param>
        /// <param name="scale">The scale.</param>
        /// <param name="size">The size.</param>
        /// <param name="parameterClass">The parameter class.</param>
        /// <param name="dataExchangeFactory">The data exchange factory.</param>
        public ParameterProperty(
            string propertyName,
            string columnName,
            string callBackName,
            string clrType,
            string dbType,
            string directionAttribute,
            string nullValue,
            Byte precision,
            Byte scale,
            int size,
            Type parameterClass,
            DataExchangeFactory dataExchangeFactory
            )
        {
            Contract.Require.That(propertyName, Is.Not.Null & Is.Not.Empty).When("retrieving argument propertyName in ParameterProperty constructor");

            this.columnName           = columnName;
            this.callBackName         = callBackName;
            this.clrType              = clrType;
            this.dbType               = dbType;
            this.nullValue            = nullValue;
            this.precision            = precision;
            this.scale                = scale;
            this.size                 = size;
            this._parameterClass      = parameterClass;
            this._dataExchangeFactory = dataExchangeFactory;

            #region Direction

            if (directionAttribute.Length > 0)
            {
                direction = (ParameterDirection)Enum.Parse(typeof(ParameterDirection), directionAttribute, true);
                this.directionAttribute = direction.ToString();
            }

            #endregion Direction

            #region Property Name

            this._currentPropertyName = propertyName;
            this._propertyPlaceholder = propertyName;

            if (propertyName.IndexOf('.') < 0)
            {
                isComplexMemberName = false;
            }
            else // complex member name FavouriteLineItem.Id
            {
                isComplexMemberName = true;
            }

            #endregion Property Name

            #region GetAccessor

            if (!typeof(IDictionary).IsAssignableFrom(parameterClass) && // Hashtable parameter map
                parameterClass != null && // value property
                !dataExchangeFactory.TypeHandlerFactory.IsSimpleType(parameterClass))    // value property
            {
                if (!isComplexMemberName)
                {
                    IGetAccessorFactory getAccessorFactory = dataExchangeFactory.AccessorFactory.GetAccessorFactory;
                    getAccessor = getAccessorFactory.CreateGetAccessor(parameterClass, propertyName);
                }
                else // complex member name FavouriteLineItem.Id
                {
                    string memberName = propertyName.Substring(propertyName.LastIndexOf('.') + 1);
                    string parentName = propertyName.Substring(0, propertyName.LastIndexOf('.'));
                    Type   parentType = ObjectProbe.GetMemberTypeForGetter(parameterClass, parentName);

                    IGetAccessorFactory getAccessorFactory = dataExchangeFactory.AccessorFactory.GetAccessorFactory;
                    getAccessor = getAccessorFactory.CreateGetAccessor(parentType, memberName);
                }
            }

            #endregion GetAccessor

            #region TypeHandler

            if (CallBackName.Length > 0)
            {
                try
                {
                    Type type = dataExchangeFactory.TypeHandlerFactory.GetType(CallBackName);
                    ITypeHandlerCallback typeHandlerCallback = (ITypeHandlerCallback)Activator.CreateInstance(type);
                    typeHandler = new CustomTypeHandler(typeHandlerCallback);
                }
                catch (Exception e)
                {
                    throw new ConfigurationException("Error occurred during custom type handler configuration.  Cause: " + e.Message, e);
                }
            }
            else
            {
                if (CLRType.Length == 0)  // Unknown
                {
                    if (getAccessor != null &&
                        dataExchangeFactory.TypeHandlerFactory.IsSimpleType(getAccessor.MemberType))
                    {
                        // Primitive
                        typeHandler = dataExchangeFactory.TypeHandlerFactory.GetTypeHandler(getAccessor.MemberType, dbType);
                    }
                    else
                    {
                        typeHandler = dataExchangeFactory.TypeHandlerFactory.GetUnkownTypeHandler();
                    }
                }
                else // If we specify a CLR type, use it
                {
                    Type type = TypeUtils.ResolveType(CLRType);

                    if (dataExchangeFactory.TypeHandlerFactory.IsSimpleType(type))
                    {
                        // Primitive
                        typeHandler = dataExchangeFactory.TypeHandlerFactory.GetTypeHandler(type, dbType);
                    }
                    else
                    {
                        // .NET object
                        type        = ObjectProbe.GetMemberTypeForGetter(parameterClass, PropertyName);
                        typeHandler = dataExchangeFactory.TypeHandlerFactory.GetTypeHandler(type, dbType);
                    }
                }
            }

            #endregion TypeHandler
        }
        /// <summary>
        /// Initializes the parameter property
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="parameterClass">The parameter class.</param>
        public void Initialize(IScope scope, Type parameterClass)
        {
            if (_directionAttribute.Length > 0)
            {
                _direction = (ParameterDirection)Enum.Parse(typeof(ParameterDirection), _directionAttribute, true);
            }

            if (!typeof(IDictionary).IsAssignableFrom(parameterClass) &&          // Hashtable parameter map
                parameterClass != null &&                // value property
                !scope.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(parameterClass))                     // value property
            {
                if (!_isComplexMemberName)
                {
                    IGetAccessorFactory getAccessorFactory = scope.DataExchangeFactory.AccessorFactory.GetAccessorFactory;
                    _getAccessor = getAccessorFactory.CreateGetAccessor(parameterClass, _propertyName);
                }
                else                 // complex member name FavouriteLineItem.Id
                {
                    string memberName = _propertyName.Substring(_propertyName.LastIndexOf('.') + 1);
                    string parentName = _propertyName.Substring(0, _propertyName.LastIndexOf('.'));
                    Type   parentType = ObjectProbe.GetMemberTypeForGetter(parameterClass, parentName);

                    IGetAccessorFactory getAccessorFactory = scope.DataExchangeFactory.AccessorFactory.GetAccessorFactory;
                    _getAccessor = getAccessorFactory.CreateGetAccessor(parentType, memberName);
                }
            }

            scope.ErrorContext.MoreInfo = "Check the parameter mapping typeHandler attribute '" + this.CallBackName + "' (must be a ITypeHandlerCallback implementation).";
            if (this.CallBackName.Length > 0)
            {
                try
                {
                    Type type = scope.DataExchangeFactory.TypeHandlerFactory.GetType(this.CallBackName);
                    ITypeHandlerCallback typeHandlerCallback = (ITypeHandlerCallback)Activator.CreateInstance(type);
                    _typeHandler = new CustomTypeHandler(typeHandlerCallback);
                }
                catch (Exception e)
                {
                    throw new ConfigurationException("Error occurred during custom type handler configuration.  Cause: " + e.Message, e);
                }
            }
            else
            {
                if (this.CLRType.Length == 0)                   // Unknown
                {
                    if (_getAccessor != null &&
                        scope.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(_getAccessor.MemberType))
                    {
                        // Primitive
                        _typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(_getAccessor.MemberType, _dbType);
                    }
                    else
                    {
                        _typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetUnkownTypeHandler();
                    }
                }
                else                 // If we specify a CLR type, use it
                {
                    Type type = TypeUtils.ResolveType(this.CLRType);

                    if (scope.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(type))
                    {
                        // Primitive
                        _typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(type, _dbType);
                    }
                    else
                    {
                        // .NET object
                        type         = ObjectProbe.GetMemberTypeForGetter(type, this.PropertyName);
                        _typeHandler = scope.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(type, _dbType);
                    }
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomTypeHandler"/> class.
 /// </summary>
 /// <param name="callback">The callback.</param>
 public CustomTypeHandler(ITypeHandlerCallback callback)
 {
     _callback = callback;
 }
        /// <summary>
        /// Initialize the PropertyInfo of the result property.
        /// </summary>
        /// <param name="resultClass"></param>
        /// <param name="configScope"></param>
        public void Initialize(ConfigurationScope configScope, Type resultClass)
        {
            if (_propertyName.Length > 0 &&
                _propertyName != "value" &&
                !typeof(IDictionary).IsAssignableFrom(resultClass))
            {
                if (!_isComplexMemberName)
                {
                    _setAccessor = configScope.DataExchangeFactory.AccessorFactory.SetAccessorFactory.CreateSetAccessor(resultClass, _propertyName);
                }
                else // complex member name FavouriteLineItem.Id
                {
                    MemberInfo propertyInfo = ObjectProbe.GetMemberInfoForSetter(resultClass, _propertyName);
                    string     memberName   = _propertyName.Substring(_propertyName.LastIndexOf('.') + 1);
                    _setAccessor = configScope.DataExchangeFactory.AccessorFactory.SetAccessorFactory.CreateSetAccessor(propertyInfo.ReflectedType, memberName);
                }

                //#if dotnet2
                _isGenericIList = TypeUtils.IsImplementGenericIListInterface(MemberType);
                //#endif
                _isIList = typeof(IList).IsAssignableFrom(MemberType);
                // set the list factory
                //#if dotnet2
                if (_isGenericIList)
                {
                    if (MemberType.IsArray)
                    {
                        _listFactory = _arrayListFactory;
                    }
                    else
                    {
                        Type[] typeArgs = MemberType.GetGenericArguments();

                        if (typeArgs.Length == 0)// Custom collection which derive from List<T>
                        {
                            _listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(MemberType, Type.EmptyTypes);
                        }
                        else
                        {
                            Type genericIList      = typeof(IList <>);
                            Type interfaceListType = genericIList.MakeGenericType(typeArgs);

                            Type genericList = typeof(List <>);
                            Type listType    = genericList.MakeGenericType(typeArgs);

                            if ((interfaceListType == MemberType) || (listType == MemberType))
                            {
                                Type constructedType = genericList.MakeGenericType(typeArgs);
                                _listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(
                                    constructedType,
                                    Type.EmptyTypes);
                            }
                            else // Custom collection which derive from List<T>
                            {
                                _listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(MemberType, Type.EmptyTypes);
                            }
                        }
                    }
                }
                else
                //#endif
                if (_isIList)
                {
                    if (MemberType.IsArray)
                    {
                        _listFactory = _arrayListFactory;
                    }
                    else
                    {
                        if (MemberType == typeof(IList))
                        {
                            _listFactory = _arrayListFactory;
                        }
                        else // custom collection
                        {
                            _listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(MemberType, Type.EmptyTypes);
                        }
                    }
                }
            }

            if (CallBackName != null && CallBackName.Length > 0)
            {
                configScope.ErrorContext.MoreInfo = "Result property '" + _propertyName + "' check the typeHandler attribute '" + CallBackName + "' (must be a ITypeHandlerCallback implementation).";
                try
                {
                    Type type = configScope.SqlMapper.TypeHandlerFactory.GetType(CallBackName);
                    ITypeHandlerCallback typeHandlerCallback = (ITypeHandlerCallback)Activator.CreateInstance(type);
                    _typeHandler = new CustomTypeHandler(typeHandlerCallback);
                }
                catch (Exception e)
                {
                    throw new ConfigurationException("Error occurred during custom type handler configuration.  Cause: " + e.Message, e);
                }
            }
            else
            {
                configScope.ErrorContext.MoreInfo = "Result property '" + _propertyName + "' set the typeHandler attribute.";
                _typeHandler = configScope.ResolveTypeHandler(resultClass, _propertyName, _clrType, _dbType, true);
            }

            if (IsLazyLoad)
            {
                _lazyFactory = new LazyFactoryBuilder().GetLazyFactory(_setAccessor.MemberType);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomTypeHandler"/> class.
        /// </summary>
        /// <param name="callback">The callback.</param>
		public CustomTypeHandler(ITypeHandlerCallback callback)
		{
			_callback = callback;
		}
Exemple #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResultProperty"/> class.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="columnIndex">Index of the column.</param>
        /// <param name="clrType">Type of the CLR.</param>
        /// <param name="callBackName">Name of the call back.</param>
        /// <param name="dbType">Type of the db.</param>
        /// <param name="isLazyLoad">if set to <c>true</c> [is lazy load].</param>
        /// <param name="nestedResultMapName">Name of the nested result map.</param>
        /// <param name="nullValue">The null value.</param>
        /// <param name="select">The select.</param>
        /// <param name="resultClass">The result class.</param>
        /// <param name="dataExchangeFactory">The data exchange factory.</param>
        /// <param name="typeHandler">The type handler.</param>
        public ResultProperty(
            string propertyName,
            string columnName,
            int columnIndex,
            string clrType,
            string callBackName,
            string dbType,
            bool isLazyLoad,
            string nestedResultMapName,
            string nullValue,
            string select,
            Type resultClass,
            DataExchangeFactory dataExchangeFactory,
            ITypeHandler typeHandler
            )
        {
            Contract.Require.That(propertyName, Is.Not.Null & Is.Not.Empty).When("retrieving argument propertyName in ResultProperty constructor");

            this.propertyName = propertyName;

            this.columnName          = columnName;
            this.callBackName        = callBackName;
            this.dbType              = dbType;
            this.clrType             = clrType;
            this.select              = select;
            this.nestedResultMapName = nestedResultMapName;
            this.isLazyLoad          = isLazyLoad;
            this.nullValue           = nullValue;
            this.columnIndex         = columnIndex;
            this.typeHandler         = typeHandler;

            #region isComplexMemberName
            if (propertyName.IndexOf('.') < 0)
            {
                isComplexMemberName = false;
            }
            else // complex member name FavouriteLineItem.Id
            {
                isComplexMemberName = true;
            }
            #endregion

            if (propertyName.Length > 0 &&
                propertyName != "value" &&
                !typeof(IDictionary).IsAssignableFrom(resultClass) &&
                !typeof(DataRow).IsAssignableFrom(resultClass))
            {
                #region SetAccessor
                if (!isComplexMemberName)
                {
                    setAccessor = dataExchangeFactory.AccessorFactory.SetAccessorFactory.CreateSetAccessor(resultClass, propertyName);
                }
                else // complex member name FavouriteLineItem.Id
                {
                    MemberInfo propertyInfo = ObjectProbe.GetMemberInfoForSetter(resultClass, propertyName);
                    string     memberName   = propertyName.Substring(propertyName.LastIndexOf('.') + 1);
                    setAccessor = dataExchangeFactory.AccessorFactory.SetAccessorFactory.CreateSetAccessor(propertyInfo.ReflectedType, memberName);
                }
                #endregion

                isGenericIList = TypeUtils.IsImplementGenericIListInterface(MemberType);
                isIList        = typeof(IList).IsAssignableFrom(MemberType);

                #region Set the list factory
                if (isGenericIList)
                {
                    if (MemberType.IsArray)
                    {
                        listFactory = arrayListFactory;
                    }
                    else
                    {
                        Type[] typeArgs = MemberType.GetGenericArguments();

                        if (typeArgs.Length == 0)// Custom collection which derive from List<T>
                        {
                            listFactory = dataExchangeFactory.ObjectFactory.CreateFactory(MemberType, Type.EmptyTypes);
                        }
                        else
                        {
                            Type genericIList      = typeof(IList <>);
                            Type interfaceListType = genericIList.MakeGenericType(typeArgs);

                            Type genericList = typeof(List <>);
                            Type listType    = genericList.MakeGenericType(typeArgs);

                            if ((interfaceListType == MemberType) || (listType == MemberType))
                            {
                                Type constructedType = genericList.MakeGenericType(typeArgs);
                                listFactory = dataExchangeFactory.ObjectFactory.CreateFactory(
                                    constructedType,
                                    Type.EmptyTypes);
                            }
                            else // Custom collection which derive from List<T>
                            {
                                listFactory = dataExchangeFactory.ObjectFactory.CreateFactory(MemberType, Type.EmptyTypes);
                            }
                        }
                    }
                }
                else if (isIList)
                {
                    if (MemberType.IsArray)
                    {
                        listFactory = arrayListFactory;
                    }
                    else
                    {
                        if (MemberType == typeof(IList))
                        {
                            listFactory = arrayListFactory;
                        }
                        else // custom collection
                        {
                            listFactory = dataExchangeFactory.ObjectFactory.CreateFactory(MemberType, Type.EmptyTypes);
                        }
                    }
                }
                #endregion
            }

            #region TypeHandler
            if (!string.IsNullOrEmpty(CallBackName))
            {
                try
                {
                    Type type = dataExchangeFactory.TypeHandlerFactory.GetType(CallBackName);
                    ITypeHandlerCallback typeHandlerCallback = (ITypeHandlerCallback)Activator.CreateInstance(type);
                    this.typeHandler = new CustomTypeHandler(typeHandlerCallback);
                }
                catch (Exception e)
                {
                    throw new ConfigurationException("Error occurred during custom type handler configuration.  Cause: " + e.Message, e);
                }
            }
            else
            {
                if (typeHandler == null)
                {
                    //configScope.ErrorContext.MoreInfo = "Result property '" + propertyName + "' set the typeHandler attribute.";
                    this.typeHandler = dataExchangeFactory.TypeHandlerFactory.ResolveTypeHandler(resultClass, propertyName, clrType, dbType, true);
                }
            }
            #endregion

            #region LazyLoad
            if (IsLazyLoad)
            {
                lazyFactory = new LazyFactoryBuilder().GetLazyFactory(setAccessor.MemberType);
            }
            #endregion

            if (!GetType().IsSubclassOf(typeof(ResultProperty)))
            {
                propertyStrategy = PropertyStrategyFactory.Get(this);
            }
        }
Exemple #10
0
        public void Initialize(ConfigurationScope configScope, Type resultClass)
        {
            if (((this._propertyName.Length > 0) && (this._propertyName != "value")) && !typeof(IDictionary).IsAssignableFrom(resultClass))
            {
                if (!this._isComplexMemberName)
                {
                    this._setAccessor = configScope.DataExchangeFactory.AccessorFactory.SetAccessorFactory.CreateSetAccessor(resultClass, this._propertyName);
                }
                else
                {
                    MemberInfo memberInfoForSetter = ObjectProbe.GetMemberInfoForSetter(resultClass, this._propertyName);
                    string     name = this._propertyName.Substring(this._propertyName.LastIndexOf('.') + 1);
                    this._setAccessor = configScope.DataExchangeFactory.AccessorFactory.SetAccessorFactory.CreateSetAccessor(memberInfoForSetter.ReflectedType, name);
                }
                this._isGenericIList = TypeUtils.IsImplementGenericIListInterface(this.MemberType);
                this._isIList        = typeof(IList).IsAssignableFrom(this.MemberType);
                if (this._isGenericIList)
                {
                    if (this.MemberType.IsArray)
                    {
                        this._listFactory = _arrayListFactory;
                    }
                    else
                    {
                        Type[] genericArguments = this.MemberType.GetGenericArguments();
                        if (genericArguments.Length == 0)
                        {
                            this._listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(this.MemberType, Type.EmptyTypes);
                        }
                        else
                        {
                            Type type2 = typeof(IList <>).MakeGenericType(genericArguments);
                            Type type3 = typeof(List <>);
                            Type type4 = type3.MakeGenericType(genericArguments);
                            if ((type2 == this.MemberType) || (type4 == this.MemberType))
                            {
                                Type typeToCreate = type3.MakeGenericType(genericArguments);
                                this._listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(typeToCreate, Type.EmptyTypes);
                            }
                            else
                            {
                                this._listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(this.MemberType, Type.EmptyTypes);
                            }
                        }
                    }
                }
                else if (this._isIList)
                {
                    if (this.MemberType.IsArray)
                    {
                        this._listFactory = _arrayListFactory;
                    }
                    else if (this.MemberType == typeof(IList))
                    {
                        this._listFactory = _arrayListFactory;
                    }
                    else
                    {
                        this._listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(this.MemberType, Type.EmptyTypes);
                    }
                }
            }
            if ((this.CallBackName != null) && (this.CallBackName.Length > 0))
            {
                configScope.ErrorContext.MoreInfo = "Result property '" + this._propertyName + "' check the typeHandler attribute '" + this.CallBackName + "' (must be a ITypeHandlerCallback implementation).";
                try
                {
                    ITypeHandlerCallback callback = (ITypeHandlerCallback)Activator.CreateInstance(configScope.SqlMapper.TypeHandlerFactory.GetType(this.CallBackName));
                    this._typeHandler = new CustomTypeHandler(callback);
                    goto Label_0320;
                }
                catch (Exception exception)
                {
                    throw new ConfigurationException("Error occurred during custom type handler configuration.  Cause: " + exception.Message, exception);
                }
            }
            configScope.ErrorContext.MoreInfo = "Result property '" + this._propertyName + "' set the typeHandler attribute.";
            this._typeHandler = configScope.ResolveTypeHandler(resultClass, this._propertyName, this._clrType, this._dbType, true);
Label_0320:
            if (this.IsLazyLoad)
            {
                this._lazyFactory = new LazyFactoryBuilder().GetLazyFactory(this._setAccessor.MemberType);
            }
        }