Пример #1
0
        /// <summary>
        /// Processes the specified <see cref="IDataReader"/>
        /// a an auto result map is used.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="reader">The reader.</param>
        /// <param name="resultObject">The result object.</param>
        public object Process(RequestScope request, ref IDataReader reader, object resultObject)
        {
            object outObject = resultObject;

            if (outObject == null)
            {
                outObject = request.CurrentResultMap.CreateInstanceOfResult(null);
            }

            AutoResultMap resultMap = InitializeAutoResultMap(request, reader, ref outObject);

            // En configuration initialiser des AutoResultMap (IResultMap) avec uniquement leur class name et class et les mettres
            // ds Statement.ResultsMap puis ds AutoMapStrategy faire comme AutoResultMap ds Java
            // tester si la request.CurrentResultMap [AutoResultMap (IResultMap)] est initialisée
            // [if (allowRemapping || getResultMappings() == null) {initialize(rs);] java
            // si ( request.Statement.AllowRemapping || (request.CurrentResultMap as AutoResultMap).IsInitalized) ....

            for (int index = 0; index < resultMap.Properties.Count; index++)
            {
                ResultProperty property = resultMap.Properties[index];
                resultMap.SetValueOfProperty(ref outObject, property,
                                             property.GetDataBaseValue(reader));
            }

            return(outObject);
        }
Пример #2
0
        public object Process(RequestScope request, ref IDataReader reader, object resultObject)
        {
            object obj2 = resultObject;

            if (obj2 == null)
            {
                obj2 = (request.CurrentResultMap as AutoResultMap).CreateInstanceOfResultClass();
            }
            AutoResultMap map = this.InitializeAutoResultMap(request, ref reader, ref obj2);

            for (int i = 0; i < map.Properties.Count; i++)
            {
                ResultProperty property = map.Properties[i];
                map.SetValueOfProperty(ref obj2, property, property.GetDataBaseValue(reader));
            }
            return(obj2);
        }