本文整理汇总了C#中RecordReader.SeekEndOfSegment方法的典型用法代码示例。如果您正苦于以下问题:C# RecordReader.SeekEndOfSegment方法的具体用法?C# RecordReader.SeekEndOfSegment怎么用?C# RecordReader.SeekEndOfSegment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordReader
的用法示例。
在下文中一共展示了RecordReader.SeekEndOfSegment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRecord
internal void ReadRecord(RecordReader reader, bool lazyLoading)
{
var compinfo = InfoProvider.GetCompoundInfo(GetType());
var recinfo = InfoProvider.GetRecordInfo(GetType());
BeforeRead(reader);
reader.BeginReadFields(0);
HashSet<string> remainingPropertiesToLoad = lazyLoading ? new HashSet<string>(compinfo.Members.Values.Where(m => m.IsLazy).SelectMany(m => m.FieldNames)) : null;
foreach (string propertyName in reader.FindFields())
{
MemberInfo meminf = compinfo.FindMember(propertyName);
if (meminf != null)
{
reader.ReadField(this, propertyName, meminf, 0);
if (remainingPropertiesToLoad != null)
{
if (!meminf.IsListType && !meminf.IsDynamic)
remainingPropertiesToLoad.Remove(propertyName);
if (!remainingPropertiesToLoad.Any())
{
// Loaded all properties that were supposed to
reader.CancelFindFields();
break;
}
}
}
else if (lazyLoading || recinfo.IsDummyRecord)
{
// Prevent segment errors when not all properties were expected to be consumed
reader.SeekEndOfSegment();
}
else
{
Log.Warning("Unexpected record property: {0}", propertyName);
}
}
reader.EndReadFields(0);
//// Make sure list properties that were supposed to be loaded are not null
//foreach (MemberInfo meminfo in members.Where(m => m.Value.IsListType && (fieldsToLoad == null || fieldsToLoad.Contains(m.Key))).Select(m => m.Value))
//{
// meminfo.EnsureListCreated(this);
//}
AfterRead(reader);
}