当前位置: 首页>>代码示例>>C#>>正文


C# ResultProperty.GetDataBaseValue方法代码示例

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


在下文中一共展示了ResultProperty.GetDataBaseValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例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


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