本文整理汇总了C#中IMapDataSource.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IMapDataSource.GetValue方法的具体用法?C# IMapDataSource.GetValue怎么用?C# IMapDataSource.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMapDataSource
的用法示例。
在下文中一共展示了IMapDataSource.GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
public object GetValue(IMapDataSource source, object obj, int index)
{
if (source == null)
throw new ArgumentNullException("source");
var value = Fields[index].ByName?
source.GetValue(obj, Fields[index].Name):
source.GetValue(obj, Fields[index].Index);
if (value == null)
{
var objectMapper = source as ObjectMapper;
if (objectMapper != null)
{
var mm = Fields[index].ByName?
objectMapper[Fields[index].Name]: objectMapper[Fields[index].Index];
if (mm == null)
throw new MappingException(string.Format(Resources.MapIndex_BadField,
objectMapper.TypeAccessor.OriginalType.Name, Fields[index]));
}
}
return value;
}
示例2: GetValue
public object GetValue(IMapDataSource source, object obj, int index)
{
object value = _fields[index].ByName ?
source.GetValue(obj, _fields[index].Name) : source.GetValue(obj, _fields[index].Index);
if (value == null)
{
ObjectMapper objectMapper = source as ObjectMapper;
if (objectMapper != null)
{
MemberMapper mm = _fields[index].ByName ?
objectMapper[_fields[index].Name] : objectMapper[_fields[index].Index];
if (mm == null)
throw new MappingException(string.Format("Type '{0}' does not contain field '{1}'.",
objectMapper.TypeAccessor.OriginalType.Name, Fields[index]));
}
}
return value;
}
示例3: Map
public void Map(
IMapDataSource source, object sourceObject, int sourceIndex,
IMapDataDestination dest, object destObject, int destIndex)
{
dest.SetValue(destObject, destIndex, source.GetValue(sourceObject, sourceIndex));
//object o = source.GetValue(sourceObject, sourceIndex);
//if (o == null) dest.SetNull (destObject, destIndex);
//else dest.SetValue(destObject, destIndex, o);
}