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


C# RecordReader.EndReadFields方法代码示例

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


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

示例1: OnComplete

        internal void OnComplete(RecordReader reader, int depth)
        {
            reader.EndReadFields(depth);

            // Make sure list fields that were supposed to be loaded are not null
            var members = InfoProvider.GetCompoundInfo(GetType()).Members;
            foreach (MemberInfo meminfo in members.Where(m => m.Value.IsListType).Select(m => m.Value))
            {
                meminfo.EnsureListCreated(this);
            }

            AfterRead(reader);
        }
开发者ID:unforbidable,项目名称:patcher,代码行数:13,代码来源:Compound.cs

示例2: 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);
        }
开发者ID:unforbidable,项目名称:patcher,代码行数:52,代码来源:Record.cs


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