This issue has been moved from a ticket on Developer Community.
Minimal repro is just x.Where(sbyte =>) by itself in a source file. SharpLab
[severity:It's more difficult to complete my work]
using Microsoft.EntityFrameworkCore;
using System.Diagnostics;
using Tempus.Core.TreeStructures;
using Tempus.Core.TreeStructures.Helpers;
using Tempus.Data.Entities;
using Tempus.Data.Models;
using static Tempus.Core.Mappers.IMapper;
namespace Tempus.Data
{
public class CachedStavebniObjektDAO : DaoBase, IStavebniObjektDAO
{
private readonly IMapper mapper;
public CachedStavebniObjektDAO(IDbContextFactory contextFactory,
IMapper mapper) : base(contextFactory)
{
this.mapper = mapper;
}
private readonly Dictionary Cache = new Dictionary();
public void DBWarmUpCall()
{
using (var db = DB)
{
var query = from user in db.USER
select 1;
_ = query.FirstOrDefault();
}
}
/// <summary>
/// Loads the cache from the database.
/// <br>Typically this is to be called once when the server starts
/// and then upon every change in the table, the cache needs to be refreshed</br>
/// </summary>
public void LoadAll()
{
Cache.Clear();
var items = GetAllFlatStructure();
Stopwatch s = Stopwatch.StartNew();
//put in cache
foreach(var item in items)
{
Cache.Add(item.ID, item);
}
TreeEntityHelpers.BuildTree(Cache);
foreach(var item in items)
{
item.FillPathToRoot();
item.FillPathFromRoot();
}
s.Stop();
Console.WriteLine($"tree operations took {s.ElapsedMilliseconds} ms");
}
public List GetAllFlatStructure()
{
using (var db = DB)
{
var view = db.STAVEBNI_OBJEKT
.Include(s => s.Projekt).ThenInclude(p => p.KONFIGURACE_PROJEKTU).ThenInclude(k => k.SadaUrovniSO)
.Include(s => s.Projekt).ThenInclude(p => p.KONFIGURACE_PROJEKTU).ThenInclude(k => k.TypKonfigurace);
var query = from s in view
select mapper.Map(s);
var items = query.AsNoTracking().ToList();
return items;
}
}
/// <summary>
///
/// </summary>
/// If not present
private StavebniObjektEntity FindInCache(int ID)
{
return Cache[ID];
}
public StavebniObjektEntity Get(int ID)
{
return FindInCache(ID);
}
public List GetAll()
{
return Cache.Values.ToList();
}
public List GetAll(int projektID)
{
return GetAll.Where(sbyte =>)
}
}
}

Original Comments
Fiona Niu[MSFT] on 4/7/2022, 08:24 AM:
(private comment, text removed)
Jan Seriš on 4/7/2022, 05:28 PM:
(private comment, text removed)
Feedback Bot on 4/8/2022, 06:38 AM:
(private comment, text removed)
Feedback Bot on 4/8/2022, 09:21 PM:
(private comment, text removed)
Original Solutions
(no solutions)
This issue has been moved from a ticket on Developer Community.
Minimal repro is just
x.Where(sbyte =>)by itself in a source file. SharpLab[severity:It's more difficult to complete my work]
Original Comments
Fiona Niu[MSFT] on 4/7/2022, 08:24 AM:
(private comment, text removed)
Jan Seriš on 4/7/2022, 05:28 PM:
(private comment, text removed)
Feedback Bot on 4/8/2022, 06:38 AM:
(private comment, text removed)
Feedback Bot on 4/8/2022, 09:21 PM:
(private comment, text removed)
Original Solutions
(no solutions)