-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
I'm upgrading an application from ASP.NET Core 3.1 to 6.0. Reading the migration documents, I found this:
And I'm using that method here:
public class MainDbContext : DbContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// ...
// Map JSON string properties to the native type jsonb.
foreach (var entity in modelBuilder.Model.GetEntityTypes())
{
foreach (var property in entity.GetProperties())
{
if (property.GetColumnName().EndsWith("Json") &&
property.ClrType == typeof(string))
{
property.SetColumnType("jsonb");
}
}
}
}
}This doesn't compile anymore. The migration document has a code sample that doesn't look right to me. I don't want to look up anything in "Users" here but I need the column of a table. (Are there other columns, too?!) The documentation of the method itself is not helpful as it does not explain what I should pass as parameter.
How can I make that code work again with the current EF version? I want that method back and I don't understand why it was removed. It has always worked perfectly for me. This change is not an improvement for me.
EF Core version: 6.0
Database provider: PostgreSQL
Target framework: .NET 6.0
Operating system: Windows 10, Linux
IDE: Visual Studio 2022