dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.78k stars 3.19k forks source link

Breaking changes in 1.1 affecting SapientGuardian MySQL provider #6926

Closed divega closed 8 years ago

divega commented 8 years ago

Here is some information about missing methods from pushing the SapientGuardian.EntityFrameworkCore.MySql v7.1.11 provider through NGen (similar to how I did for #6783):

Warning: System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.ContainsTranslator..ctor()'. while resolving 0xa000023 - Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.ContainsTranslator..ctor.
Warning: System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.EndsWithTranslator..ctor()'. while resolving 0xa000037 - Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.EndsWithTranslator..ctor.
Warning: System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.StartsWithTranslator..ctor()'. while resolving 0xa00003a - Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.StartsWithTranslator..ctor.
Method not found: 'Void Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.ContainsTranslator..ctor()'. while compiling method MySqlContainsTranslator..ctor
Method not found: 'Void Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal.EndsWithTranslator..ctor()'. while compiling method MySQLCompositeMethodCallTranslator..ctor

The cause is that we removed the parameterless constructors from string method translators in 5e1c562ae40c16ef49b90731fd015eccce0c1d44.

Creating this issue so that we can decide in triage whether we want to fix this for the same reason we reverted the removal of EntityTypeExtensions.DisplayName() (see https://github.com/aspnet/EntityFramework/issues/6914#issuecomment-257962521) or whether we want to apply the default bar for internal types.

sweetwxh commented 8 years ago

I'm using the official provider for mysql, and have the same issue. Almost all operation throws MissingMethodException. It's fine on previous version of efcore. I also updated Microsoft.EntityFrameworkCore.Relational to 1.1.0, but doesn't make any sense.

Below is one of the operation's exception:

Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory..ctor(Microsoft.EntityFrameworkCore.Infrastructure.ISensitiveDataLogger`1<Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory>, System.Diagnostics.DiagnosticSource, Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMapper)'.

Here is my project.json:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.EntityFrameworkCore": "1.1.0-*",
    "Microsoft.EntityFrameworkCore.Relational": "1.1.0-preview1-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final",
    "Microsoft.NETCore.App": {
      "version": "1.1.0-preview1-001100-00",
      "type": "platform"
    },
    "MySql.Data.EntityFrameworkCore": "7.0.6-IR31"
  },

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final"
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": "dnxcore50"
    }
  }
}
rowanmiller commented 8 years ago

@sweetwxh can you open an new issue and include a code listing we can run to see the error.

mguinness commented 7 years ago

@sweetwxh were you able to get this working? I upgraded a project to 1.1 yesterday and got "Method not found" with the official MySQL provider. It's not clear to me what the fix is, which package update is necessary to overcome this problem?

UPDATE It works fine using SapientGuardian.EntityFrameworkCore.MySql but rather a problem with MySql.Data.EntityFrameworkCore.

rowanmiller commented 7 years ago

@mguinness I've passed this info on to the MySQL team, but you may also want to report it directly so that they can track how many folks are hitting it https://bugs.mysql.com/.

tobiashoeft commented 7 years ago

Any news? :(

mguinness commented 7 years ago

@tobiashoeft Avoid MySql.Data.EntityFrameworkCore for now and use SapientGuardian.EntityFrameworkCore.MySql or Pomelo.EntityFrameworkCore.MySql instead.

avikenjale commented 7 years ago

Basically this issue is getting when I tried to implement method 'OnModelCreating' and using new feature .HasField for MySql database. I go with normal implementation of mySql model without using new feature, it works.

avikenjale commented 7 years ago

I am using Pomelo.EntityFrameworkCore.MySql, as native MySQL library has some another issues like Data Annotations TableAttribute, ColumnAttribute

geminiyellow commented 7 years ago

same error

Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory..ctor(Microsoft.EntityFrameworkCore.Infrastructure.ISensitiveDataLogger`1<Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory>, System.Diagnostics.DiagnosticSource, Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMapper)'.

MySql.Data.EntityFrameworkCore still die.

mguinness commented 7 years ago

@geminiyellow See if Unable to run Migrations with EFCore 1.1.0 in MySQL resolves your issue.

JanWerder commented 7 years ago

@mguinness Your solution solves the problem at hand, but it seems like the beta still has a problem with the Transaction Commit. But thanks anyways! 👍

mguinness commented 7 years ago

@JanWerder Try using the Pomelo provider instead, they're about to release 1.1.1 version.

JanWerder commented 7 years ago

@mguinness That works great! Thank you! 😄