本文整理汇总了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;
}
示例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;
}
示例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;
}