We are reading relational database specific metadata using RelationalMetadataExtensions in dotnet core 2.0. We have planned to upgrade the app into 3.0. But RelationalMetadataExtensions is obsolute in the dotnet core 3.0. What will be the dotnet core 3.1 behavior of the following code
// Following code only working for mysql.
var items = _context.Model.GetEntityTypes();
foreach (var item in items)
{
//RelationalMetadataExtensions.Relational([NotNullAttribute] this IEntityType entityType)
if (item.Relational() is RelationalEntityTypeAnnotations extensions)
{
extensions.Schema = database;
}
}
Based on the update log, your code will not work. You will need to use the flattened out versions.
Unfortunately, the issue 214 seems to still be open. I can see the GetSchema has been implemented already, but no SetSchema to be found. You could raise a new GitHub request to see when (if) it's getting there
Edit
There is a SetSchema check here. Kudos to Ivan Stoev.
Provider-specific Metadata API changes
Tracking Issue #214
New behavior
The provider-specific extension methods will be flattened out:
IProperty.Relational().ColumnName -> IProperty.GetColumnName()IEntityType.SqlServer().IsMemoryOptimized -> IEntityType.IsMemoryOptimized()PropertyBuilder.UseSqlServerIdentityColumn() -> PropertyBuilder.UseIdentityColumn()Why
This change simplifies the implementation of the aforementioned extension methods.
Mitigations
Use the new extension methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With