Pomelo.entityframeworkcore.mysql: MySQL provider is using internal code

Created on 27 Feb 2018  路  7Comments  路  Source: PomeloFoundation/Pomelo.EntityFrameworkCore.MySql

See issue reported here: https://github.com/aspnet/EntityFrameworkCore/issues/11078

RelationalParameterBuilder is internal code, which changes from release to release. This makes using internal code in a provider a very bad idea because it breaks anyone using that provider when the internal code is changed. This is preventing MySQL from being used with EF Core 2.1.

The MySql provider should be updated to use no internal EF code. If there are places where using such code is needed, then these should be communicated to the EF team such that we can address the issue or suggest workarounds.

Most helpful comment

Any progress or ETA on this?

All 7 comments

Thanks for the report @ajcvickers we'll try to get that reference out

We use the same convention as aspnet/entityframework where we use Microsoft.EntityFrameworkCore.* namespaces in our code, including in our internal directories. So that makes it hard to tell what not to import since we are using the same internal namespace. Should we be using something else for our internal namespaces? For example would it be good to change:

namespace Microsoft.EntityFrameworkCore.Storage.Internal
{
    public class MySqlTypeMapper : RelationalTypeMapper

to

namespace EFCore.MySql.Storage.Internal
{
    public class MySqlTypeMapper : RelationalTypeMapper

@caleblloyd That's really up to you, but I agree that it would make it easier to differentiate between EF internal and provider internal. I'll file an issue on our repo to decide whether this should become guidance for providers.

Here is all of the internal references to upstream in our codebase right now after renaming our internal namespaces:

regex="using Microsoft[\.a-zA-Z]+Internal"
for i in $(find . -type f -name "*.cs" | xargs grep -iP "$regex" -sl);
do
    echo $i;
    grep -iP "$regex" $i;
    echo "";
done
./Storage/Internal/MySqlRelationalCommand.cs
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Storage.Internal;

./Storage/Internal/MySqlCommandBuilder.cs
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Storage.Internal;

./Storage/Internal/MySqlRelationalConnection.cs
using Microsoft.EntityFrameworkCore.Internal;

./Storage/Internal/MySqlRelationalTransaction.cs
using Microsoft.EntityFrameworkCore.Internal;

./Scaffolding/Internal/MySqlTableSelectionSetExtensions.cs
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;

./Scaffolding/Internal/MySqlDatabaseModelFactory.cs
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;

./Utilities/Check.cs
using Microsoft.EntityFrameworkCore.Internal;

./Metadata/Conventions/MySqlConventionSetBuilder.cs
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;

./Metadata/Conventions/Internal/MySqlValueGenerationStrategyConvention.cs
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Metadata/MySqlPropertyAnnotations.cs
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Metadata/Internal/MySqlInternalMetadataBuilderExtensions.cs
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Metadata/Internal/MySqlModelBuilderAnnotations.cs
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Metadata/Internal/MySqlEntityTypeBuilderAnnotations.cs
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Metadata/Internal/MySqlIndexBuilderAnnotations.cs
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Metadata/Internal/MySqlPropertyBuilderAnnotations.cs
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Metadata/Internal/MySqlKeyBuilderAnnotations.cs
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Extensions/MySqlPropertyBuilderExtensions.cs
using Microsoft.EntityFrameworkCore.Metadata.Internal;

./Extensions/MySqlServiceCollectionExtensions.cs
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;

./Update/Internal/MySqlModificationCommandBatch.cs
using Microsoft.EntityFrameworkCore.Internal;

./Internal/MySqlOptions.cs
using Microsoft.EntityFrameworkCore.Internal;

At first glance, this is going to require a lot of copying of EF Upstream files into the provider. I don't know if that is worth it; it may be easier for us just to say that any upgrade in EF will have to depend on an upgrade in the provider.

Any progress or ETA on this?

How about this issue now? Or any tricks for preventing this.

This issue can probably be closed now, see https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/514 for updates.

Was this page helpful?
0 / 5 - 0 ratings