Skip to content

Commit

Permalink
Improve getting streams #2521 #2522
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Sep 17, 2021
1 parent 9a85f57 commit 5f0fbed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Src/Dnn/ToSic.Sxc.Dnn/Dnn/Cms/DnnPagePublishing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void Publish(int instanceId, int version)

private IEnumerable<IEntity> TryToAddStream(IEnumerable<IEntity> list, IBlockDataSource data, string key)
{
var cont = data.Out.ContainsKey(key) ? data[key]?.List?.ToImmutableList() : null;
var cont = data.GetStream(key, nullIfNotFound: true)?.List.ToImmutableList(); // data.Out.ContainsKey(key) ? data[key]?.List?.ToImmutableList() : null;
Log.Add($"TryToAddStream(..., ..., key:{key}), found:{cont != null} add⋮{cont?.Count ?? 0}" );
if (cont != null) list = list.Concat(cont);
return list;
Expand Down
18 changes: 7 additions & 11 deletions Src/Oqtane/ToSic.Sxc.Oqt.Server/Run/OqtPagePublishing.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ToSic.Eav.Apps.Environment;
using ToSic.Eav.Context;
using ToSic.Eav.Data;
using ToSic.Eav.Logging;
using ToSic.Sxc.Cms.Publishing;
using ToSic.Sxc.Context;
using ToSic.Sxc.DataSources;
using ToSic.Sxc.Oqt.Shared;


Expand Down Expand Up @@ -50,13 +46,13 @@ public void Publish(int instanceId, int version)
Log.Add("publish never happened ");
}

private IEnumerable<IEntity> TryToAddStream(IEnumerable<IEntity> list, IBlockDataSource data, string key)
{
var cont = data.Out.ContainsKey(key) ? data[key]?.List : null;
Log.Add($"TryToAddStream(..., ..., key:{key}), found:{cont != null} add⋮{cont?.Count() ?? 0}");
if (cont != null) list = list.Concat(cont);
return list;
}
//private IEnumerable<IEntity> TryToAddStream(IEnumerable<IEntity> list, IBlockDataSource data, string key)
//{
// var cont = data.GetStream(key, nullIfNotFound: true)?.List; // data.Out.ContainsKey(key) ? data[key]?.List : null;
// Log.Add($"TryToAddStream(..., ..., key:{key}), found:{cont != null} add⋮{cont?.Count() ?? 0}");
// if (cont != null) list = list.Concat(cont);
// return list;
//}

}
}
2 changes: 1 addition & 1 deletion Src/Sxc/ToSic.Sxc/Code/DynamicCodeRoot_As.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public IEnumerable<dynamic> AsList(object list)
case null:
return new List<dynamic>();
case IDataSource dsEntities:
return AsList(dsEntities[Eav.Constants.DefaultStreamName]);
return AsList(dsEntities.List); // [Eav.Constants.DefaultStreamName]);
case IEnumerable<IEntity> iEntities:
return iEntities.Select(e => AsDynamic(e));
case IEnumerable<IDynamicEntity> dynIDynEnt:
Expand Down

0 comments on commit 5f0fbed

Please sign in to comment.