コード例 #1
0
        //注册使用内容项,用于生成集合属性用。
        private void RegisterItem(DbDataReader reader, OutputContentCollection collection)
        {
            string key = string.Join("_", ItemKeyFields.Select(a => reader.GetValue(a).ToString()).ToArray());

            if (!collection.TryGetValue(key, out OutputContentItem item))
            {
                item = new OutputContentItem();
                var content = CreateItem(reader, item);
                if (content != null)
                {
                    item.Content = content;
                    collection.Add(key, item);
                }
            }
            foreach (var kv in item.Collections)
            {
                kv.Key.RegisterItem(reader, kv.Value);
            }
        }
コード例 #2
0
ファイル: CollectionOutputInfo.cs プロジェクト: zyj0021/Mego
 /// <inheritdoc/>
 protected override void LoadDataToContent(DbDataReader reader, IOutputContent content)
 {
     if (!IsEmpty(reader))
     {
         var collection = (OutputContentCollection)content;
         if (HasCollectionProperty)
         {
             string key = string.Join("_", ItemKeyFields.Select(a => reader.GetValue(a).ToString()).ToArray());
             if (!collection.TryGetValue(key, out OutputContentObject item))
             {
                 item = CreateContentItem(reader);
                 collection.Add(key, item);
             }
             base.LoadDataToContent(reader, item);
         }
         else
         {
             collection.Add(CreateObjectItem(reader));
         }
     }
 }