本文整理汇总了C#中IMapDataSource类的典型用法代码示例。如果您正苦于以下问题:C# IMapDataSource类的具体用法?C# IMapDataSource怎么用?C# IMapDataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMapDataSource类属于命名空间,在下文中一共展示了IMapDataSource类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapInternal
protected override void MapInternal(Reflection.InitContext initContext, IMapDataSource source, object sourceObject, IMapDataDestination dest, object destObject, params object[] parameters)
{
FullObjectMapper mapper = (FullObjectMapper)initContext.ObjectMapper;
IDataReader dataReader = (IDataReader)sourceObject;
//int[] index = GetIndex(source, dest);
//IValueMapper[] mappers = GetValueMappers(source, dest, index);
//foreach (var valueMapper in mappers)
//{
//}
InitSchema(dataReader);
if (mapper.ColParent)
{
FillObject(mapper, dataReader, destObject);
while (dataReader.Read())
{
destObject = FillObject(destObject, mapper, dataReader);
}
}
else
FillObject(mapper, dataReader, destObject);
}
示例2: 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;
}
示例3: 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;
}
示例4: Map
public override void Map(IMapDataSource source, object sourceObject, int sourceIndex, IMapDataDestination destination, object destinationObject, int destinationIndex)
{
if(source.IsNull(sourceObject, sourceIndex))
{
destination.SetDecimal(destinationObject, destinationIndex, 0);
}
else
{
destination.SetDecimal(destinationObject, destinationIndex, Convert.ToDecimal(source.GetByte(sourceObject, sourceIndex)));
}
}
示例5: 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);
}
示例6: SimpleSourceListMapper
public SimpleSourceListMapper(IMapDataSource mapper)
{
_mapper = mapper;
}
示例7: GetValueOrIndex
public object GetValueOrIndex(IMapDataSource source, object obj)
{
return Fields.Length == 1?
GetValue(source, obj, 0):
GetIndexValue(source, obj);
}
示例8: GetValueOrIndex
public object GetValueOrIndex(IMapDataSource source, object obj)
{
if (Fields.Length == 1)
return GetValue(source, obj, 0);
return GetIndexValue(source, obj);
}
示例9: GetIndexValue
public CompoundValue GetIndexValue(IMapDataSource source, object obj)
{
object[] values = new string[Fields.Length];
for (int i = 0; i < values.Length; i++)
values[i] = GetValue(source, obj, i);
return new CompoundValue(values);
}
示例10: Map
public abstract void Map(IMapDataSource source, object sourceObject, int sourceIndex, IMapDataDestination destination, object destinationObject, int destinationIndex);