/// <summary>
        /// Builds the specified lazy load proxy for a concrete class with virtual method.
        /// </summary>
        /// <param name="dataMapper">The data mapper.</param>
        /// <param name="selectStatement">The mapped statement used to build the lazy loaded object.</param>
        /// <param name="param">The parameter object used to build lazy loaded object.</param>
        /// <param name="target">The target object which contains the property proxydied..</param>
        /// <param name="setAccessor">The proxified member accessor.</param>
        /// <returns>Return a proxy object</returns>
        public object CreateProxy(
            IDataMapper dataMapper,
            IMappedStatement selectStatement, object param, 
			object target, ISetAccessor setAccessor)
		{
			Type typeProxified = setAccessor.MemberType;

            if (logger.IsDebugEnabled)
            {
                logger.Debug(string.Format("Statement '{0}', create proxy for member {1}.", selectStatement.Id, setAccessor.MemberType));
            }

            // Build the proxy
            IInterceptor interceptor= new LazyLoadInterceptor(dataMapper, selectStatement, param, target, setAccessor);

            // if you want to proxy concrete classes, there are also 2 main requirements : 
            // the class can not be sealed and only virtual methods can be intercepted. 
            // The reason is that DynamicProxy will create a subclass of your class overriding all methods 
            // so it can dispatch the invocations to the interceptor.

            // The proxified type must also have an empty constructor
            object generatedProxy = proxyGenerator.CreateClassProxy(typeProxified, Type.EmptyTypes, interceptor);

            return generatedProxy;
        }
Beispiel #2
0
        public ISetAccessor CreateSetAccessor(Type targetType, string name)
        {
            string key = new StringBuilder(targetType.FullName).Append(".").Append(name).ToString();

            if (this._cachedISetAccessor.Contains(key))
            {
                return((ISetAccessor)this._cachedISetAccessor[key]);
            }
            ISetAccessor accessor = null;

            lock (this._syncObject)
            {
                if (!this._cachedISetAccessor.Contains(key))
                {
                    MemberInfo setter = ReflectionInfo.GetInstance(targetType).GetSetter(name);
                    if (setter == null)
                    {
                        throw new ProbeException(string.Format("No property or field named \"{0}\" exists for type {1}.", name, targetType));
                    }
                    if (setter is PropertyInfo)
                    {
                        accessor = this._createPropertySetAccessor(targetType, name);
                        this._cachedISetAccessor[key] = accessor;
                        return(accessor);
                    }
                    accessor = this._createFieldSetAccessor(targetType, name);
                    this._cachedISetAccessor[key] = accessor;
                    return(accessor);
                }
                return((ISetAccessor)this._cachedISetAccessor[key]);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Builds the specified lazy load proxy for a concrete class with virtual method.
        /// </summary>
        /// <param name="dataMapper">The data mapper.</param>
        /// <param name="selectStatement">The mapped statement used to build the lazy loaded object.</param>
        /// <param name="param">The parameter object used to build lazy loaded object.</param>
        /// <param name="target">The target object which contains the property proxydied..</param>
        /// <param name="setAccessor">The proxified member accessor.</param>
        /// <returns>Return a proxy object</returns>
        public object CreateProxy(
            IDataMapper dataMapper,
            IMappedStatement selectStatement, object param,
            object target, ISetAccessor setAccessor)
        {
            Type typeProxified = setAccessor.MemberType;

            if (logger.IsDebugEnabled)
            {
                logger.Debug(string.Format("Statement '{0}', create proxy for member {1}.", selectStatement.Id, setAccessor.MemberType));
            }

            // Build the proxy
            IInterceptor interceptor = new LazyLoadInterceptor(dataMapper, selectStatement, param, target, setAccessor);

            // if you want to proxy concrete classes, there are also 2 main requirements :
            // the class can not be sealed and only virtual methods can be intercepted.
            // The reason is that DynamicProxy will create a subclass of your class overriding all methods
            // so it can dispatch the invocations to the interceptor.

            // The proxified type must also have an empty constructor
            object generatedProxy = proxyGenerator.CreateClassProxy(typeProxified, Type.EmptyTypes, interceptor);

            return(generatedProxy);
        }
 internal LazyLoadInterceptor(IMappedStatement mappedSatement, object param, object target, ISetAccessor setAccessor)
 {
     this._param         = param;
     this._statementName = mappedSatement.Id;
     this._sqlMap        = mappedSatement.SqlMap;
     this._target        = target;
     this._setAccessor   = setAccessor;
 }
Beispiel #5
0
 public LazyList(IMappedStatement mappedSatement, object param, object target, ISetAccessor setAccessor)
 {
     this._param       = param;
     this._statementId = mappedSatement.Id;
     this._sqlMap      = mappedSatement.SqlMap;
     this._target      = target;
     this._setAccessor = setAccessor;
 }
 /// <summary>
 /// Create a new proxy instance.
 /// </summary>
 /// <param name="dataMapper">The data mapper.</param>
 /// <param name="mappedStatement">The mapped statement.</param>
 /// <param name="param">The param.</param>
 /// <param name="target">The target.</param>
 /// <param name="setAccessor">The set accessor.</param>
 /// <returns>Returns a new proxy.</returns>
 public object CreateProxy(
     IDataMapper dataMapper,
     IMappedStatement mappedStatement, 
     object param,
     object target, 
     ISetAccessor setAccessor)
 {
     return new LazyList(dataMapper, mappedStatement, param, target, setAccessor);
 }
 /// <summary>
 /// Create a new proxy instance.
 /// </summary>
 /// <param name="dataMapper">The data mapper.</param>
 /// <param name="mappedStatement">The mapped statement.</param>
 /// <param name="param">The param.</param>
 /// <param name="target">The target.</param>
 /// <param name="setAccessor">The set accessor.</param>
 /// <returns>Returns a new proxy.</returns>
 public object CreateProxy(
     IDataMapper dataMapper,
     IMappedStatement mappedStatement,
     object param,
     object target,
     ISetAccessor setAccessor)
 {
     return(new LazyList(dataMapper, mappedStatement, param, target, setAccessor));
 }
Beispiel #8
0
        public void TestProtectedSetAccessor()
        {
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Index");

            PropertySon son = new PropertySon();

            accessorSet.Set(son, -99);

            Assert.AreEqual(-99, son.Index);
        }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:LazyList"/> class.
 /// </summary>
 /// <param name="mappedSatement">The mapped satement.</param>
 /// <param name="param">The param.</param>
 /// <param name="target">The target.</param>
 /// <param name="setAccessor">The set accessor.</param>
 public LazyList(IMappedStatement mappedSatement, object param,
                 object target, ISetAccessor setAccessor)
 {
     _list        = new ArrayList();
     _param       = param;
     _statementId = mappedSatement.Id;
     _sqlMap      = mappedSatement.SqlMap;
     _target      = target;
     _setAccessor = setAccessor;
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:LazyList"/> class.
 /// </summary>
 /// <param name="mappedSatement">The mapped satement.</param>
 /// <param name="param">The param.</param>
 /// <param name="target">The target.</param>
 /// <param name="setAccessor">The set accessor.</param>
 public LazyList(IMappedStatement mappedSatement, object param,
     object target, ISetAccessor setAccessor)
 {
     _list = new ArrayList();
     _param = param;
     _statementId = mappedSatement.Id;
     _sqlMap = mappedSatement.SqlMap;
     _target = target;
     _setAccessor = setAccessor;
 }
Beispiel #11
0
        public void TestSetPropertyOverrideByNew()
        {
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Float");

            PropertySon son = new PropertySon();

            accessorSet.Set(son, -99);

            Assert.AreEqual(-99 * 2, son.Float);
        }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the LazyListGeneric class.
 /// </summary>
 /// <param name="mappedSatement">The mapped satement.</param>
 /// <param name="param">The param.</param>
 /// <param name="target">The target.</param>
 /// <param name="setAccessor">The set accessor.</param>
 public LazyListGeneric(IMappedStatement mappedSatement, object param,
                        object target, ISetAccessor setAccessor)
 {
     _param       = param;
     _statementId = mappedSatement.Id;
     _sqlMap      = mappedSatement.SqlMap;
     _target      = target;
     _setAccessor = setAccessor;
     _list        = new List <T>();
 }
Beispiel #13
0
        public void TestJIRA210OnSet()
        {
            Address adr = new Address();

            Guid newGuid = Guid.NewGuid();

            ISetAccessor domainSet = factorySet.CreateSetAccessor(typeof(IAddress), "Id");

            domainSet.Set(adr, newGuid);
            Assert.AreEqual(newGuid, adr.Id);
        }
Beispiel #14
0
 public LazyListGeneric(IMappedStatement mappedSatement, object param, object target, ISetAccessor setAccessor)
 {
     this._statementId = string.Empty;
     this._loadLock    = new object();
     this._param       = param;
     this._statementId = mappedSatement.Id;
     this._sqlMap      = mappedSatement.SqlMap;
     this._target      = target;
     this._setAccessor = setAccessor;
     this._list        = new List <T>();
 }
 /// <summary>
 /// Constructor for a lazy list loader
 /// </summary>
 /// <param name="dataMapper">The data mapper.</param>
 /// <param name="mappedSatement">The mapped statement used to build the list</param>
 /// <param name="param">The parameter object used to build the list</param>
 /// <param name="target">The target object which contains the property proxydied.</param>
 /// <param name="setAccessor">The proxified member accessor.</param>
 public LazyLoadInterceptor(
     IDataMapper dataMapper,
     IMappedStatement mappedSatement, object param,
     object target, ISetAccessor setAccessor)
 {
     this.param = param;
     statementName = mappedSatement.Id;
     this.dataMapper = dataMapper;
     this.target = target;
     this.setAccessor = setAccessor;
 }
Beispiel #16
0
        public void TestVirtualIMemberAccessor2()
        {
            IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "Int");
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Int");

            PropertySon son = new PropertySon();
            Int32       i   = (Int32)accessorGet.Get(son);

            Assert.IsTrue(i == -88);
            accessorSet.Set(son, 9);
        }
Beispiel #17
0
 /// <summary>
 /// Constructor for a lazy list loader
 /// </summary>
 /// <param name="dataMapper">The data mapper.</param>
 /// <param name="mappedSatement">The mapped statement used to build the list</param>
 /// <param name="param">The parameter object used to build the list</param>
 /// <param name="target">The target object which contains the property proxydied.</param>
 /// <param name="setAccessor">The proxified member accessor.</param>
 public LazyLoadInterceptor(
     IDataMapper dataMapper,
     IMappedStatement mappedSatement, object param,
     object target, ISetAccessor setAccessor)
 {
     this.param       = param;
     statementName    = mappedSatement.Id;
     this.dataMapper  = dataMapper;
     this.target      = target;
     this.setAccessor = setAccessor;
 }
Beispiel #18
0
        public void TestVirtualIMemberAccessor1()
        {
            IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "Account");
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Account");

            PropertySon son     = new PropertySon();
            Account     account = (Account)accessorGet.Get(son);

            Assert.IsTrue(account.Days == Days.Wed);
            accessorSet.Set(son, new Account());
        }
Beispiel #19
0
        public void TestVirtualIMemberAccessor3()
        {
            IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "DateTime");
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "DateTime");

            PropertySon son  = new PropertySon();
            DateTime    date = (DateTime)accessorGet.Get(son);

            Assert.AreEqual(new DateTime(2000, 1, 1), date);
            accessorSet.Set(son, DateTime.Now);
        }
Beispiel #20
0
        //[ExpectedException(typeof(InvalidOperationException), ExpectedMessage = "Test virtual")]
        public void TestVirtualIMemberAccessor3()
        {
            IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "DateTime");
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "DateTime");

            PropertySon son  = new PropertySon();
            DateTime    date = (DateTime)accessorGet.Get(son);

            Assert.AreEqual(new DateTime(2000, 1, 1), date);

            Assert.That(() => accessorSet.Set(son, DateTime.Now), Throws.TypeOf <InvalidOperationException>().With.Message.EqualTo("Test virtual"));
        }
Beispiel #21
0
 /// <summary>
 /// Initializes a new instance of the LazyListGeneric class.
 /// </summary>
 /// <param name="dataMapper">The data mapper.</param>
 /// <param name="mappedSatement">The mapped satement.</param>
 /// <param name="param">The param.</param>
 /// <param name="target">The target.</param>
 /// <param name="setAccessor">The set accessor.</param>
 public LazyListGeneric(
     IDataMapper dataMapper,
     IMappedStatement mappedSatement, object param,
     object target, ISetAccessor setAccessor)
 {
     _param          = param;
     _statementId    = mappedSatement.Id;
     this.dataMapper = dataMapper;
     _target         = target;
     _setAccessor    = setAccessor;
     _list           = new List <T>();
 }
Beispiel #22
0
        //[ExpectedException(typeof(InvalidOperationException), ExpectedMessage = "Test virtual")]
        public void TestVirtualIMemberAccessor2()
        {
            IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "Int");
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Int");

            PropertySon son = new PropertySon();
            Int32       i   = (Int32)accessorGet.Get(son);

            Assert.IsTrue(i == -88);

            Assert.That(() => accessorSet.Set(son, 9), Throws.TypeOf <InvalidOperationException>().With.Message.EqualTo("Test virtual"));
        }
Beispiel #23
0
        public void TestMemberAccessorFactory()
        {
            IGetAccessor accessor11 = factoryGet.CreateGetAccessor(typeof(Property), "Int");
            IGetAccessor accessor12 = factoryGet.CreateGetAccessor(typeof(Property), "Int");

            Assert.AreEqual(HashCodeProvider.GetIdentityHashCode(accessor11), HashCodeProvider.GetIdentityHashCode(accessor12));

            ISetAccessor accessor21 = factorySet.CreateSetAccessor(typeof(Property), "Int");
            ISetAccessor accessor22 = factorySet.CreateSetAccessor(typeof(Property), "Int");

            Assert.AreEqual(HashCodeProvider.GetIdentityHashCode(accessor21), HashCodeProvider.GetIdentityHashCode(accessor22));
        }
Beispiel #24
0
        public void TestPrivateSetterOnGenericVariable2()
        {
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(SpecialReference <Account>), "_value");

            SpecialReference <Account> referenceAccount = new SpecialReference <Account>();
            Account account = new Account(5);

            accessorSet.Set(referenceAccount, account);

            Assert.AreEqual(account, referenceAccount.Value);
            Assert.AreEqual(account.Id, referenceAccount.Value.Id);
        }
Beispiel #25
0
        //[ExpectedException(typeof(InvalidOperationException), ExpectedMessage = "Test virtual")]
        public void TestVirtualIMemberAccessor1()
        {
            IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "Account");
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Account");

            PropertySon son     = new PropertySon();
            Account     account = (Account)accessorGet.Get(son);

            Assert.IsTrue(account.Days == Days.Wed);
            ;

            Assert.That(() => accessorSet.Set(son, new Account()), Throws.TypeOf <InvalidOperationException>().With.Message.EqualTo("Test virtual"));
        }
        /// <summary>
        /// Create a new proxy instance.
        /// </summary>
        /// <param name="mappedStatement">The mapped statement.</param>
        /// <param name="param">The param.</param>
        /// <param name="target">The target.</param>
        /// <param name="setAccessor">The set accessor.</param>
        /// <returns>Returns a new proxy.</returns>
        public object CreateProxy(IMappedStatement mappedStatement, object param,
            object target, ISetAccessor setAccessor)
        {
            Type elementType = setAccessor.MemberType.GetGenericArguments()[0];
            Type lazyType = typeof(LazyListGeneric<>);
            Type lazyGenericType = lazyType.MakeGenericType(elementType);

             Type[] parametersType = { typeof(IMappedStatement), typeof(object), typeof(object), typeof(ISetAccessor) };

             IFactory factory = mappedStatement.SqlMap.DataExchangeFactory.ObjectFactory.CreateFactory(lazyGenericType, parametersType);

             object[] parameters = { mappedStatement, param, target, setAccessor };
             return factory.CreateInstance(parameters);
        }
Beispiel #27
0
        public void TestPrivateSetterOnGenericVariable()
        {
            ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "_referenceAccount");

            PropertySon son = new PropertySon();
            SpecialReference <Account> referenceAccount = new SpecialReference <Account>();
            Account account = new Account(5);

            referenceAccount.Value = account;
            accessorSet.Set(son, referenceAccount);

            Assert.AreEqual(son.ReferenceAccount, referenceAccount);
            Assert.AreEqual(son.ReferenceAccount.Value.Id, referenceAccount.Value.Id);
        }
        /// <summary>
        /// Create a new proxy instance.
        /// </summary>
        /// <param name="mappedStatement">The mapped statement.</param>
        /// <param name="param">The param.</param>
        /// <param name="target">The target.</param>
        /// <param name="setAccessor">The set accessor.</param>
        /// <returns>Returns a new proxy.</returns>
        public object CreateProxy(IMappedStatement mappedStatement, object param,
                                  object target, ISetAccessor setAccessor)
        {
            Type elementType     = setAccessor.MemberType.GetGenericArguments()[0];
            Type lazyType        = typeof(LazyListGeneric <>);
            Type lazyGenericType = lazyType.MakeGenericType(elementType);

            Type[] parametersType = { typeof(IMappedStatement), typeof(object), typeof(object), typeof(ISetAccessor) };

            IFactory factory = mappedStatement.SqlMap.DataExchangeFactory.ObjectFactory.CreateFactory(lazyGenericType, parametersType);

            object[] parameters = { mappedStatement, param, target, setAccessor };
            return(factory.CreateInstance(parameters));
        }
Beispiel #29
0
        /// <summary>
        /// 复制
        /// </summary>
        /// <param name="obj">源对象</param>
        /// <param name="value">目的对象</param>
        public void Copy(object obj, object value)
        {
            lock (this)
            {
                if (this.propertyDic == null)
                {
                    this.propertyDic = new Dictionary <string, PropertyInfo>();
                    if (obj != null)
                    {
                        Type t = obj.GetType();
                        foreach (PropertyInfo propertyInfo in t.GetProperties())
                        {
                            if (propertyInfo.CanWrite && propertyInfo.CanRead)
                            {
                                this.propertyDic.Add(propertyInfo.Name, propertyInfo);
                            }
                        }
                    }
                }
            }
            IGetAccessor valueGetAccessor = null;

            if (value is IGetAccessor)
            {
                valueGetAccessor = value as IGetAccessor;
            }
            ISetAccessor objSetAccessor = null;

            if (obj is ISetAccessor)
            {
                objSetAccessor = obj as ISetAccessor;
            }

            foreach (KeyValuePair <string, PropertyInfo> kp in this.propertyDic)
            {
                if (objSetAccessor != null && valueGetAccessor != null)
                {
                    objSetAccessor.SetValue(kp.Key, valueGetAccessor.GetValue(kp.Key));
                }
                else if (objSetAccessor != null && valueGetAccessor == null)
                {
                    objSetAccessor.SetValue(kp.Key, kp.Value.GetValue(value, null));
                }
                else if (objSetAccessor == null && valueGetAccessor == null)
                {
                    kp.Value.SetValue(obj, kp.Value.GetValue(value, null), null);
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// Sets the member.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberValue">The member value.</param>
        /// <param name="accessorFactory">The accessor factory.</param>
        public static void SetMember(object obj, string memberName, object memberValue,
                                     AccessorFactory accessorFactory)
        {
            try
            {
                if (memberName.IndexOf("[") > -1)
                {
                    SetArrayMember(obj, memberName, memberValue, accessorFactory);
                }
                else
                {
                    if (obj is IDictionary)
                    {
                        ((IDictionary)obj)[memberName] = memberValue;
                    }
                    else if (obj is IDictionary <string, object> )
                    {
                        ((IDictionary <string, object>)obj)[memberName] = memberValue;
                    }
                    else
                    {
                        Type targetType = obj.GetType();
                        ISetAccessorFactory setAccessorFactory = accessorFactory.SetAccessorFactory;
                        ISetAccessor        setAccessor        = setAccessorFactory.CreateSetAccessor(targetType, memberName);

                        if (setAccessor == null)
                        {
                            throw new ProbeException("No Set method for member " + memberName + " on instance of " + obj.GetType().Name);
                        }
                        try
                        {
                            setAccessorFactory.CreateSetAccessor(targetType, memberName).Set(obj, memberValue);
                        }
                        catch (Exception ex)
                        {
                            throw new ProbeException(ex);
                        }
                    }
                }
            }
            catch (ProbeException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new ProbeException("Could not Get property '" + memberName + "' for " + obj.GetType().Name + ".  Cause: " + e.Message, e);
            }
        }
Beispiel #31
0
        /// <summary>
        /// Sets the value to the parameter property.
        /// </summary>
        /// <remarks>Use to set value on output parameter</remarks>
        /// <param name="mapping"></param>
        /// <param name="target"></param>
        /// <param name="dataBaseValue"></param>
        public override void SetData(ref object target, ParameterProperty mapping, object dataBaseValue)
        {
            if (mapping.IsComplexMemberName)
            {
                ObjectProbe.SetMemberValue(target, mapping.PropertyName, dataBaseValue,
                                           this.DataExchangeFactory.ObjectFactory,
                                           this.DataExchangeFactory.AccessorFactory);
            }
            else
            {
                ISetAccessorFactory setAccessorFactory = this.DataExchangeFactory.AccessorFactory.SetAccessorFactory;
                ISetAccessor        _setAccessor       = setAccessorFactory.CreateSetAccessor(_parameterClass, mapping.PropertyName);

                _setAccessor.Set(target, dataBaseValue);
            }
        }
        public ISetAccessor CreateSetAccessor(Type targetType, string name)
        {
            string key = new StringBuilder(targetType.FullName).Append(".").Append(name).ToString();

            if (_cachedISetAccessor.Contains(key))
            {
                return((ISetAccessor)_cachedISetAccessor[key]);
            }
            else
            {
                ISetAccessor setAccessor = null;
                lock (_syncObject)
                {
                    if (!_cachedISetAccessor.Contains(key))
                    {
                        // Property
                        ReflectionInfo reflectionCache = ReflectionInfo.GetInstance(targetType);
                        MemberInfo     memberInfo      = reflectionCache.GetSetter(name);

                        if (memberInfo != null)
                        {
                            if (memberInfo is PropertyInfo)
                            {
                                setAccessor = _createPropertySetAccessor(targetType, name);
                                _cachedISetAccessor[key] = setAccessor;
                            }
                            else
                            {
                                setAccessor = _createFieldSetAccessor(targetType, name);
                                _cachedISetAccessor[key] = setAccessor;
                            }
                        }
                        else
                        {
                            throw new ProbeException(
                                      string.Format("No property or field named \"{0}\" exists for type "
                                                    + "{1}.", name, targetType));
                        }
                    }
                    else
                    {
                        setAccessor = (ISetAccessor)_cachedISetAccessor[key];
                    }
                }
                return(setAccessor);
            }
        }
Beispiel #33
0
        public void SetUp()
        {
            intSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicInt");
            intGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicInt");

            longSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicLong");
            longGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicLong");

            sbyteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicSbyte");
            sbyteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicSbyte");

            stringSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicString");
            stringGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicString");

            datetimeSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDateTime");
            datetimeGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDateTime");

            decimalSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDecimal");
            decimalGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDecimal");

            byteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicByte");
            byteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicByte");

            charSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicChar");
            charGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicChar");

            shortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicShort");
            shortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicShort");

            ushortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicUshort");
            ushortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicUshort");

            uintSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicUint");
            uintGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicUint");

            ulongSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicUlong");
            ulongGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicUlong");

            boolSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicBool");
            boolGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicBool");

            doubleSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDouble");
            doubleGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDouble");

            floatSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicFloat");
            floatGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicFloat");

            guidSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicGuid");
            guidGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicGuid");

            timespanSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicTimeSpan");
            timespanGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicTimeSpan");

            accountSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicAccount");
            accountGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicAccount");

            enumSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDay");
            enumGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDay");

#if dotnet2
            nullableSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicintNullable");
            nullableGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicintNullable");
#endif
        }
Beispiel #34
0
        public void SetUp()
        {
            intSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedInt");
            intGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedInt");

            longSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedLong");
            longGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedLong");

            sbyteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedSbyte");
            sbyteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedSbyte");

            stringSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedString");
            stringGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedString");

            datetimeSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDateTime");
            datetimeGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDateTime");

            decimalSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDecimal");
            decimalGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDecimal");

            byteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedByte");
            byteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedByte");

            charSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedChar");
            charGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedChar");

            shortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedShort");
            shortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedShort");

            ushortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedUshort");
            ushortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedUshort");

            uintSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedUint");
            uintGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedUint");

            ulongSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedUlong");
            ulongGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedUlong");

            boolSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedBool");
            boolGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedBool");

            doubleSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDouble");
            doubleGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDouble");

            floatSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedFloat");
            floatGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedFloat");

            guidSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedGuid");
            guidGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedGuid");

            timespanSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedTimeSpan");
            timespanGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedTimeSpan");

            accountSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedAccount");
            accountGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedAccount");

            enumSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDay");
            enumGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDay");

#if dotnet2
            nullableSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedintNullable");
            nullableGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedintNullable");
#endif
        }
        public void SetUp()
        {
            intSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedInt");
            intGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedInt");

            longSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedLong");
            longGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedLong");

            sbyteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedSbyte");
            sbyteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedSbyte");

            stringSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedString");
            stringGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedString");

            datetimeSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDateTime");
            datetimeGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDateTime");

            decimalSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDecimal");
            decimalGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDecimal");

            byteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedByte");
            byteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedByte");

            charSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedChar");
            charGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedChar");

            shortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedShort");
            shortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedShort");

            ushortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedUshort");
            ushortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedUshort");

            uintSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedUint");
            uintGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedUint");

            ulongSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedUlong");
            ulongGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedUlong");

            boolSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedBool");
            boolGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedBool");

            doubleSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDouble");
            doubleGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDouble");

            floatSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedFloat");
            floatGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedFloat");

            guidSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedGuid");
            guidGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedGuid");

            timespanSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedTimeSpan");
            timespanGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedTimeSpan");

            accountSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedAccount");
            accountGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedAccount");

            enumSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedDay");
            enumGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedDay");

            nullableSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "protectedintNullable");
            nullableGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "protectedintNullable");
        }
 /// <summary>
 /// Initialize a the result property
 /// for AutoMapper
 /// </summary>
 /// <param name="setAccessor">An <see cref="ISetAccessor"/>.</param>
 /// <param name="typeHandlerFactory"></param>
 internal void Initialize(TypeHandlerFactory typeHandlerFactory, ISetAccessor setAccessor)
 {
     _setAccessor = setAccessor;
     _typeHandler = typeHandlerFactory.GetTypeHandler(setAccessor.MemberType);
 }
        public void SetUp()
        {
            intSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicInt");
            intGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicInt");

            longSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicLong");
            longGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicLong");

            sbyteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicSbyte");
            sbyteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicSbyte");

            stringSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicString");
            stringGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicString");

            datetimeSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDateTime");
            datetimeGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDateTime");

            decimalSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDecimal");
            decimalGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDecimal");

            byteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicByte");
            byteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicByte");

            charSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicChar");
            charGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicChar");

            shortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicShort");
            shortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicShort");

            ushortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicUshort");
            ushortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicUshort");

            uintSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicUint");
            uintGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicUint");

            ulongSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicUlong");
            ulongGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicUlong");

            boolSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicBool");
            boolGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicBool");

            doubleSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDouble");
            doubleGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDouble");

            floatSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicFloat");
            floatGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicFloat");

            guidSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicGuid");
            guidGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicGuid");

            timespanSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicTimeSpan");
            timespanGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicTimeSpan");

            accountSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicAccount");
            accountGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicAccount");

            enumSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicDay");
            enumGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicDay");

            nullableSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicintNullable");
            nullableGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicintNullable");
        }
        /// <summary>
        /// Constructor for a lazy list loader
        /// </summary>
        /// <param name="mappedSatement">The mapped statement used to build the list</param>
        /// <param name="param">The parameter object used to build the list</param>
        /// <param name="setAccessor">The proxified member accessor.</param>
        /// <param name="target">The target object which contains the property proxydied.</param>
        internal LazyLoadInterceptor(IMappedStatement mappedSatement, object param,
			object target, ISetAccessor setAccessor)
        {
            _param = param;
            _statementName = mappedSatement.Id;
            _sqlMap = mappedSatement.SqlMap;
            _target = target;
            _setAccessor = setAccessor;
        }
Beispiel #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:LazyList"/> class.
 /// </summary>
 /// <param name="dataMapper">The data mapper.</param>
 /// <param name="mappedSatement">The mapped satement.</param>
 /// <param name="param">The param.</param>
 /// <param name="target">The target.</param>
 /// <param name="setAccessor">The set accessor.</param>
 public LazyList(
     IDataMapper dataMapper,
     IMappedStatement mappedSatement, 
     object param,
     object target, 
     ISetAccessor setAccessor)
 {
     _list = new ArrayList();
     _param = param;
     _statementId = mappedSatement.Id;
     this.dataMapper = dataMapper;
     _target = target;
     _setAccessor = setAccessor;
 }
Beispiel #40
0
		/// <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);
				}

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

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

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

                            if ((interfaceListType == this.MemberType) || (listType == this.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(this.MemberType, Type.EmptyTypes);
                            }  
			            }			            
			        }
			    }
			    else if (_isIList)
			    {
                    if (this.MemberType.IsArray)
                    {
                        _listFactory = _arrayListFactory;
                    }
			        else
                    {
                        if (this.MemberType == typeof(IList))
                        {
                            _listFactory = _arrayListFactory;
                        }
                        else // custom collection
                        {
                            _listFactory = configScope.DataExchangeFactory.ObjectFactory.CreateFactory(this.MemberType,                                                                                                   Type.EmptyTypes);
                        }                        
                    }
			    }
			}

			if (this.CallBackName!=null && this.CallBackName.Length >0)
			{
				configScope.ErrorContext.MoreInfo = "Result property '"+_propertyName+"' 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 );
					_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 (this.IsLazyLoad)
            {
                _lazyFactory = new LazyFactoryBuilder().GetLazyFactory(_setAccessor.MemberType);
            }
		}
Beispiel #41
0
		/// <summary>
		/// Initialize a the result property
		/// for AutoMapper
		/// </summary>
        /// <param name="setAccessor">An <see cref="ISetAccessor"/>.</param>
		/// <param name="typeHandlerFactory"></param>
		internal void Initialize(TypeHandlerFactory typeHandlerFactory, ISetAccessor setAccessor )
		{
            _setAccessor = setAccessor;
            _typeHandler = typeHandlerFactory.GetTypeHandler(setAccessor.MemberType);
		}
Beispiel #42
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);
            }
        }