• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ResultMapping.ResultProperty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IBatisNet.DataMapper.Configuration.ResultMapping.ResultProperty的典型用法代码示例。如果您正苦于以下问题:C# ResultProperty类的具体用法?C# ResultProperty怎么用?C# ResultProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResultProperty类属于IBatisNet.DataMapper.Configuration.ResultMapping命名空间,在下文中一共展示了ResultProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SelectStrategy

        /// <summary>
        /// Initializes a new instance of the <see cref="SelectStrategy"/> class.
        /// </summary>
        /// <param name="mapping">The mapping.</param>
        /// <param name="selectArrayStrategy">The select array strategy.</param>
        /// <param name="selectGenericListStrategy">The select generic list strategy.</param>
        /// <param name="selectListStrategy">The select list strategy.</param>
        /// <param name="selectObjectStrategy">The select object strategy.</param>
        public SelectStrategy(ResultProperty mapping,
            IArgumentStrategy selectArrayStrategy,
            IArgumentStrategy selectGenericListStrategy,
            IArgumentStrategy selectListStrategy,
            IArgumentStrategy selectObjectStrategy)
        {
            // Collection object or .NET object
            if (mapping.MemberType.BaseType == typeof(Array))
            {
                _selectStrategy = selectArrayStrategy;
            }
            else if (mapping.MemberType.IsGenericType &&
                 typeof(IList<>).IsAssignableFrom(mapping.MemberType.GetGenericTypeDefinition()))
            {
                _selectStrategy = selectGenericListStrategy;
            }

            // Check if the object to Map implement 'IList' or is IList type
            // If yes the ResultProperty is map to a IList object
            else if (typeof(IList).IsAssignableFrom(mapping.MemberType))
            {
                _selectStrategy = selectListStrategy;
            }

            else // The ResultProperty is map to a .Net object
            {
                _selectStrategy = selectObjectStrategy;
            }
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:37,代码来源:SelectStrategy.cs


示例2: GetValue

        /// <summary>
        /// Gets the value of an argument constructor.
        /// </summary>
        /// <param name="request">The current <see cref="RequestScope"/>.</param>
        /// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
        /// <param name="reader">The current <see cref="IDataReader"/>.</param>
        /// <param name="keys">The keys</param>
        /// <returns>The paremeter value.</returns>
        public object GetValue(RequestScope request, ResultProperty mapping, 
            ref IDataReader reader, object keys)
        {
            if (mapping.TypeHandler == null ||
                mapping.TypeHandler is UnknownTypeHandler) // Find the TypeHandler
            {
                lock(mapping)
                {
                    if (mapping.TypeHandler == null || mapping.TypeHandler is UnknownTypeHandler)
                    {
                        int columnIndex = 0;
                        if (mapping.ColumnIndex == ResultProperty.UNKNOWN_COLUMN_INDEX)
                        {
                            columnIndex = reader.GetOrdinal(mapping.ColumnName);
                        }
                        else
                        {
                            columnIndex = mapping.ColumnIndex;
                        }
                        Type systemType =((IDataRecord)reader).GetFieldType(columnIndex);

                        mapping.TypeHandler = request.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(systemType);
                    }
                }
            }

            object dataBaseValue = mapping.GetDataBaseValue( reader );
            request.IsRowDataFound = request.IsRowDataFound || (dataBaseValue != null);

            return dataBaseValue;
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:39,代码来源:DefaultStrategy.cs


示例3: Process

        /// <summary>
        /// Processes the specified <see cref="IDataReader"/> 
        /// when no resultClass or resultMap attribute are specified.
        /// </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 (reader.FieldCount == 1)
            {
                ResultProperty property = new ResultProperty();
                property.PropertyName = "value";
                property.ColumnIndex = 0;
                property.TypeHandler = request.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(reader.GetFieldType(0));
                outObject = property.GetDataBaseValue(reader);
            }
            else if (reader.FieldCount > 1)
            {
                object[] newOutObject = new object[reader.FieldCount];
                int count = reader.FieldCount;
                for (int i = 0; i < count; i++)
                {
                    ResultProperty property = new ResultProperty();
                    property.PropertyName = "value";
                    property.ColumnIndex = i;
                    property.TypeHandler = request.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(reader.GetFieldType(i));
                    newOutObject[i] = property.GetDataBaseValue(reader);
                }

                outObject = newOutObject;
            }
            else
            {
                // do nothing if 0 fields
            }

            return outObject;
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:41,代码来源:ObjectStrategy.cs


示例4: Set

        ///<summary>
        /// Sets value of the specified <see cref="ResultProperty"/> on the target object
        /// when a 'select' attribute exists and fills an <see cref="IList"/> property
        /// on the <see cref="ResultProperty"/> are empties.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="resultMap">The result map.</param>
        /// <param name="mapping">The ResultProperty.</param>
        /// <param name="target">The target.</param>
        /// <param name="reader">The current <see cref="IDataReader"/></param>
        /// <param name="keys">The keys</param>
        public void Set(RequestScope request, IResultMap resultMap, 
            ResultProperty mapping, ref object target, IDataReader reader, object keys)
        {
            // Get the select statement
            IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);

            PostBindind postSelect = new PostBindind();
            postSelect.Statement = selectStatement;
            postSelect.Keys = keys;
            postSelect.Target = target;
            postSelect.ResultProperty = mapping;

            if (mapping.IsLazyLoad)
            {
                object values = mapping.LazyFactory.CreateProxy(selectStatement, keys, target, mapping.SetAccessor);
                mapping.SetAccessor.Set(target, values);
            }
            else
            {
                if (mapping.SetAccessor.MemberType == typeof(IList))
                {
                    postSelect.Method = PostBindind.ExecuteMethod.ExecuteQueryForIList;
                }
                else
                {
                    postSelect.Method = PostBindind.ExecuteMethod.ExecuteQueryForStrongTypedIList;
                }
                request.QueueSelect.Enqueue(postSelect);
            }
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:41,代码来源:SelectListStrategy.cs


示例5: Process

        /// <summary>
        /// Processes the specified <see cref="IDataReader"/> 
        /// when a ResultClass is specified on the statement and
        /// the ResultClass is a SimpleType.
        /// </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;
            AutoResultMap resultMap = request.CurrentResultMap as AutoResultMap;

            if (outObject == null)
            {
                outObject = resultMap.CreateInstanceOfResultClass();
            }

            if (!resultMap.IsInitalized)
            {
                lock(resultMap)
                {
                    if (!resultMap.IsInitalized)
                    {
                        // Create a ResultProperty
                        ResultProperty property = new ResultProperty();
                        property.PropertyName = "value";
                        property.ColumnIndex = 0;
                        property.TypeHandler = request.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(outObject.GetType());
                        property.PropertyStrategy = PropertyStrategyFactory.Get(property);

                        resultMap.Properties.Add(property);
                        resultMap.DataExchange = request.DataExchangeFactory.GetDataExchangeForClass(typeof(int));// set the PrimitiveDataExchange
                        resultMap.IsInitalized = true;
                    }
                }
            }

            resultMap.Properties[0].PropertyStrategy.Set(request, resultMap, resultMap.Properties[0], ref outObject, reader, null);

            return outObject;
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:42,代码来源:SimpleTypeStrategy.cs


示例6: Process

        /// <summary>
        /// Processes the specified <see cref="IDataReader"/> 
        /// when a 'resultClass' attribute is specified on the statement and
        /// the 'resultClass' attribute is a <see cref="IDictionary"/>.
        /// </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;
            AutoResultMap resultMap = request.CurrentResultMap as AutoResultMap;

            if (outObject == null)
            {
                outObject = resultMap.CreateInstanceOfResultClass();
            }

            int count = reader.FieldCount;
            IDictionary dictionary = (IDictionary) outObject;
            for (int i = 0; i < count; i++)
            {
                ResultProperty property = new ResultProperty();
                property.PropertyName = "value";
                property.ColumnIndex = i;
                property.TypeHandler = request.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(reader.GetFieldType(i));
                dictionary.Add(
                    reader.GetName(i),
                    property.GetDataBaseValue(reader));
            }

            return outObject;
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:33,代码来源:DictionaryStrategy.cs


示例7: GetValue

        /// <summary>
        /// Gets the value of an argument constructor.
        /// </summary>
        /// <param name="request">The current <see cref="RequestScope"/>.</param>
        /// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
        /// <param name="reader">The current <see cref="IDataReader"/>.</param>
        /// <param name="keys">The keys</param>
        /// <returns>The paremeter value.</returns>
        public object GetValue(RequestScope request, ResultProperty mapping, 
            ref IDataReader reader, object keys)
        {
            // Get the select statement
            IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);

            reader = DataReaderTransformer.Transform(reader, request.Session.DataSource.DbProvider);
            return selectStatement.ExecuteQueryForObject(request.Session, keys);
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:17,代码来源:SelectObjectStrategy.cs


示例8: GetValueByIndex

 /// <summary>
 /// Gets a column value by the index
 /// </summary>
 /// <param name="mapping"></param>
 /// <param name="dataReader"></param>
 /// <returns></returns>
 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
 {
     if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
     {
         return DBNull.Value;
     }
     else
     {
         return new UInt64?(Convert.ToUInt64(dataReader.GetValue(mapping.ColumnIndex)));
     }
 }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:17,代码来源:NullableUInt64TypeHandler.cs


示例9: GetValueByIndex

 /// <summary>
 /// Gets a column value by the index
 /// </summary>
 /// <param name="mapping"></param>
 /// <param name="dataReader"></param>
 /// <returns></returns>
 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
 {
     if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
     {
         return DBNull.Value;
     }
     else
     {
         return Enum.Parse(mapping.MemberType, dataReader.GetValue(mapping.ColumnIndex).ToString());
     }
 }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:17,代码来源:EnumTypeHandler.cs


示例10: GetValueByIndex

 /// <summary>
 /// Gets a column value by the index
 /// </summary>
 /// <param name="mapping"></param>
 /// <param name="dataReader"></param>
 /// <returns></returns>
 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
 {
     if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
     {
         return DBNull.Value;
     }
     else
     {
         return new DateTime?(dataReader.GetDateTime(mapping.ColumnIndex));
     }
 }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:17,代码来源:NullableDateTimeTypeHandler.cs


示例11: GetValueByIndex

 /// <summary>
 /// Gets a column value by the index
 /// </summary>
 /// <param name="mapping"></param>
 /// <param name="dataReader"></param>
 /// <returns></returns>
 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
 {
     if (dataReader.IsDBNull(mapping.ColumnIndex) || dataReader.GetBytes(mapping.ColumnIndex, 0, null, 0, 0) == 0)
     {
         return DBNull.Value;
     }
     else
     {
         return GetValueByIndex(mapping.ColumnIndex, dataReader);
     }
 }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:17,代码来源:ByteArrayTypeHandler.cs


示例12: GetValueByIndex

 /// <summary>
 /// Gets a column value by the index
 /// </summary>
 /// <param name="mapping"></param>
 /// <param name="dataReader"></param>
 /// <returns></returns>
 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
 {
     if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
     {
         return System.DBNull.Value;
     }
     else
     {
         return dataReader.GetValue(mapping.ColumnIndex);
     }
 }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:17,代码来源:ObjectTypeHandler.cs


示例13: GetValueByIndex

 /// <summary>
 /// Gets a column value by the index
 /// </summary>
 /// <param name="mapping"></param>
 /// <param name="dataReader"></param>
 /// <returns></returns>
 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
 {
     if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
     {
         return DBNull.Value;
     }
     else
     {
         // Don't used dataReader.GetInt32 to fix oracle who alwray return decimal type
         return Convert.ToUInt16(dataReader.GetValue(mapping.ColumnIndex));
     }
 }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:18,代码来源:UInt16TypeHandler.cs


示例14: Deserialize

        /// <summary>
        /// Deserialize a ResultProperty object
        /// </summary>
        /// <param name="node"></param>
        /// <param name="configScope"></param>
        /// <returns></returns>
        public static ResultProperty Deserialize(XmlNode node, ConfigurationScope configScope)
        {
            ResultProperty resultProperty = new ResultProperty();

            NameValueCollection prop = NodeUtils.ParseAttributes(node, configScope.Properties);
            resultProperty.CLRType = NodeUtils.GetStringAttribute(prop, "type");
            resultProperty.CallBackName = NodeUtils.GetStringAttribute(prop, "typeHandler");
            resultProperty.ColumnIndex = NodeUtils.GetIntAttribute( prop, "columnIndex", ResultProperty.UNKNOWN_COLUMN_INDEX  );
            resultProperty.ColumnName = NodeUtils.GetStringAttribute(prop, "column");
            resultProperty.DbType = NodeUtils.GetStringAttribute(prop, "dbType");
            resultProperty.IsLazyLoad = NodeUtils.GetBooleanAttribute( prop, "lazyLoad", false);
            resultProperty.NestedResultMapName = NodeUtils.GetStringAttribute(prop, "resultMapping");
            resultProperty.NullValue = prop["nullValue"];
            resultProperty.PropertyName = NodeUtils.GetStringAttribute(prop, "property");
            resultProperty.Select = NodeUtils.GetStringAttribute(prop, "select");

            return resultProperty;
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:24,代码来源:ResultPropertyDeSerializer.cs


示例15: GetValue

        /// <summary>
        /// Gets the value of an argument constructor.
        /// </summary>
        /// <param name="request">The current <see cref="RequestScope"/>.</param>
        /// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
        /// <param name="reader">The current <see cref="IDataReader"/>.</param>
        /// <param name="keys">The keys</param>
        /// <returns>The paremeter value.</returns>
        public object GetValue(RequestScope request, ResultProperty mapping, 
            ref IDataReader reader, object keys)
        {
            // Get the select statement
            IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);

            reader = DataReaderTransformer.Transform(reader, request.Session.DataSource.DbProvider);
            IList values = selectStatement.ExecuteQueryForList(request.Session, keys);

            Type elementType = mapping.MemberType.GetElementType();
            Array array = Array.CreateInstance(elementType, values.Count);
            int count = values.Count;
            for(int i=0;i<count;i++)
            {
                array.SetValue(values[i],i);
            }
            return array;
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:26,代码来源:SelectArrayStrategy.cs


示例16: Set

        ///<summary>
        /// Sets value of the specified <see cref="ResultProperty"/> on the target object
        /// when a 'select' attribute exists and fills an Array property
        /// on the <see cref="ResultProperty"/> are empties.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="resultMap">The result map.</param>
        /// <param name="mapping">The ResultProperty.</param>
        /// <param name="target">The target.</param>
        /// <param name="reader">The <see cref="IDataReader"/></param>
        /// <param name="keys">The keys</param>
        public void Set(RequestScope request, IResultMap resultMap, 
			ResultProperty mapping, ref object target, IDataReader reader, object keys)
        {
            // Get the select statement
            IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);

            PostBindind postSelect = new PostBindind();
            postSelect.Statement = selectStatement;
            postSelect.Keys = keys;
            postSelect.Target = target;
            postSelect.ResultProperty = mapping;

            if (mapping.IsLazyLoad)
            {
                throw new NotImplementedException("Lazy load no supported for System.Array property:" + mapping.SetAccessor.Name);
            }
            postSelect.Method = PostBindind.ExecuteMethod.ExecuteQueryForArrayList;
            request.QueueSelect.Enqueue(postSelect);
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:30,代码来源:SelectArrayStrategy.cs


示例17: GetValue

        /// <summary>
        /// Gets the value of an argument constructor.
        /// </summary>
        /// <param name="request">The current <see cref="RequestScope"/>.</param>
        /// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
        /// <param name="reader">The current <see cref="IDataReader"/>.</param>
        /// <param name="keys">The keys</param>
        /// <returns>The paremeter value.</returns>
        public object GetValue(RequestScope request, ResultProperty mapping, 
		                       ref IDataReader reader, object keys)
        {
            // Get the select statement
            IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);

            if (mapping.MemberType == typeof(IList))
            {
                reader = DataReaderTransformer.Transform(reader, request.Session.DataSource.DbProvider);
                return selectStatement.ExecuteQueryForList(request.Session, keys);
            }
            else // Strongly typed List
            {
                reader = DataReaderTransformer.Transform(reader, request.Session.DataSource.DbProvider);
                IFactory factory = request.DataExchangeFactory.ObjectFactory.CreateFactory(mapping.MemberType, Type.EmptyTypes);
                object values = factory.CreateInstance(null);
                selectStatement.ExecuteQueryForList(request.Session, keys, (IList)values);
                return values;
            }
        }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:28,代码来源:SelectListStrategy.cs


示例18: Get

 /// <summary>
 /// Finds the <see cref="IPropertyStrategy"/>.
 /// </summary>
 /// <param name="mapping">The <see cref="ResultProperty"/>.</param>
 /// <returns>The <see cref="IPropertyStrategy"/></returns>
 public static IPropertyStrategy Get(ResultProperty mapping)
 {
     // no 'select' or 'resultMap' attributes
     if (mapping.Select.Length == 0 && mapping.NestedResultMap == null)
     {
         // We have a 'normal' ResultMap
         return _defaultStrategy;
     }
     else if (mapping.NestedResultMap != null) // 'resultMap' attribute
     {
         if (mapping.NestedResultMap.GroupByPropertyNames.Count>0)
         {
             return _groupByStrategy;
         }
         else
         {
             if (mapping.MemberType.IsGenericType &&
                 typeof(IList<>).IsAssignableFrom(mapping.MemberType.GetGenericTypeDefinition()))
             {
                 return _groupByStrategy;
             }
             else
                 if (typeof(IList).IsAssignableFrom(mapping.MemberType))
                 {
                     return _groupByStrategy;
                 }
                 else
                 {
                     return _resultMapStrategy;
                 }
         }
     }
     else //'select' ResultProperty
     {
         return new SelectStrategy(mapping,
             _selectArrayStrategy,
             _selectGenericListStrategy,
             _selectListStrategy,
             _selectObjectStrategy);
     }
 }
开发者ID:zuifengke,项目名称:windy-ibatisnet,代码行数:46,代码来源:PropertyStrategyFactory.cs


示例19: Get

        /// <summary>
        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="resultMap">The result map.</param>
        /// <param name="mapping">The mapping.</param>
        /// <param name="reader">The reader.</param>
        /// <param name="target">The target object</param>
        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, ref object target, IDataReader reader)
        {
            object[] parameters = null;
            bool isParameterFound = false;

            IResultMap resultMapping = mapping.NestedResultMap.ResolveSubMap(reader);

            if (resultMapping.Parameters.Count > 0)
            {
                parameters = new object[resultMapping.Parameters.Count];
                // Fill parameters array
                for (int index = 0; index < resultMapping.Parameters.Count; index++)
                {
                    ResultProperty resultProperty = resultMapping.Parameters[index];
                    parameters[index] = resultProperty.ArgumentStrategy.GetValue(request, resultProperty, ref reader, null);
                    request.IsRowDataFound = request.IsRowDataFound || (parameters[index] != null);
                    isParameterFound = isParameterFound || (parameters[index] != null);
                }
            }

            object obj = null;
            // If I have a constructor tag and all argumments values are null, the obj is null
            if (resultMapping.Parameters.Count > 0 && isParameterFound == false)
            {
                obj = null;
            }
            else
            {
                obj = resultMapping.CreateInstanceOfResult(parameters);

                // Fills properties on the new object
                if (this.FillObjectWithReaderAndResultMap(request, reader, resultMapping, ref obj) == false)
                {
                    obj = null;
                }
            }

            return obj;
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:47,代码来源:ResultMapStrategy.cs


示例20: GetValue

        /// <summary>
        /// Gets the value of an argument constructor.
        /// </summary>
        /// <param name="request">The current <see cref="RequestScope"/>.</param>
        /// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
        /// <param name="reader">The current <see cref="IDataReader"/>.</param>
        /// <param name="keys">The keys</param>
        /// <returns>The paremeter value.</returns>
        public object GetValue(RequestScope request, ResultProperty mapping, 
            ref IDataReader reader, object keys)
        {
            // Get the select statement
            IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);

            reader = DataReaderTransformer.Transform(reader, request.Session.DataSource.DbProvider);

            Type[] typeArgs = mapping.MemberType.GetGenericArguments();
            Type genericList = typeof(IList<>);
            Type constructedType = genericList.MakeGenericType(typeArgs);
            Type elementType = mapping.MemberType.GetGenericArguments()[0];

            Type mappedStatementType = selectStatement.GetType();

            Type[] typeArguments = { typeof(SqlMapSession), typeof(object) };

            MethodInfo[] mis = mappedStatementType.GetMethods(BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance);
            MethodInfo mi = null;
            foreach (MethodInfo m in mis)
            {
                if (m.IsGenericMethod &&
                    m.Name == "ExecuteQueryForList" &&
                    m.GetParameters().Length == 2)
                {
                    mi = m;
                    break;
                }
            }

            MethodInfo miConstructed = mi.MakeGenericMethod(elementType);

            // Invoke the method.
            object[] args = { request.Session, keys };
            object values = miConstructed.Invoke(selectStatement, args);

            return values;
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:46,代码来源:SelectGenericListStrategy.cs



注:本文中的IBatisNet.DataMapper.Configuration.ResultMapping.ResultProperty类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AvalonEdit.TextEditor类代码示例发布时间:2022-05-26
下一篇:
C# DB2.DB2Connection类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap