I have an in memory data set in EF Core for .NET 8 along with the method below for saving entities into the context
public static async Task SaveDataToEntitySetAsync<TEntity>(DbContext context, List<TEntity> list) where TEntity : BaseEntity
{
if (list.Any())
{
var dbSet = context.Set<TEntity>();
var nonNulls = list.Where(x => x != null);
if(list.Any(x=>x== null))
{
throw new Exception($"Null Detected: {list.GetType().Name}");
}
foreach (var item in nonNulls)
{
dbSet.Add(item);
}
await context.SaveChangesAsync();
}
}
This code worked fine in .NET Core 3.1 but in .NET 8 there are no errors but nothing gets saved into the Db context
Has anyone seen this?
Paul
10