I'm currently working on an ASP .NET 5.0 application - I migrate the app from .NET3.1 to .NET 5.0. I use Entity Framework Core with Devart.Data.Oracle.EFCore to connect to an Oracle Database.
I try to save a simple record with a string value, when I call the Context.SaveChangesAsync() method, I get this error: Sequence contains no elements, oddly the source for the exception is System.Linq => System.Linq.ThrowHelper.ThrowNoElementsException(). There is a StackTrace but no detailed inner exception message unfortunately.
My save method in the repository looks like this:
public async Task<T> Add(T entity)
{
// ...
await Context.AddAsync<T>(entity);
await Context.SaveChangesAsync();
return entity;
}
The Tree entity class looks like this:
public class Tree
{
public int Id { get; set; }
public string Name { get; set; }
}
The Tree Entity Configuration looks like this (Scaffolded with EF Core):
public void Configure(EntityTypeBuilder<Tree> entity)
{
entity.ToTable("TREES");
entity.HasIndex(e => e.Id, "SYS_C001234")
.IsUnique();
entity.Property(e => e.Id).HasColumnName("ID");
entity.Property(e => e.Name).HasColumnName("NAME");
}
On my AppContext, the Trees are registered:
public virtual DbSet<Tree> Trees { get; set; }
In the DB, the Tree table looks like this:
Column_Name | Data_Type
------------------------
ID | NUMBER(10,0)
NAME | NCLOB
It is odd, because it worked before I ported my app to .NET 5.0 and updated all NuGet packages...
I tracked down the error to the following NuGet packages updates:
I cannot update Devart.Data.Oracle.EFCore alone, because it is dependent on the Microsoft NuGet packages listed below. I must update all 5 NuGet packages at once.
After this NuGet package update, I cannot save the entity anymore.
Maybe I'm missing something in my configuration?
Do you know how to solve this issue?