Reputation: 61
I'm trying to run my first migration in a new EF Core solution that uses OracleDB. After running this command (auto-generated by JetBrains Rider Migrations utility):
"C:\Program Files\dotnet\dotnet.exe" ef migrations add --project IS.Terminals.VGM.Infrastructure\IS.Terminals.VGM.Infrastructure.csproj --startup-project IS.Terminals.VGM\IS.Terminals.VGM.csproj --context IS.Terminals.VGM.VGMContext --configuration Debug --verbose Initial --output-dir Migrations
I've encountered the following error:
Unable to create a 'DbContext' of type 'IS.Terminals.VGM.VGMContext'. The exception 'Method 'get_LockReleaseBehavior' in type 'Oracle.EntityFrameworkCore.Migrations.Internal.OracleHistoryRepository' from assembly 'Oracle.Entit
yFrameworkCore, Version=8.0.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342' does not have an implementation.' was thrown while attempting to create an instance. For the different patterns supported at design time, see ht
tps://go.microsoft.com/fwlink/?linkid=851728
I couldn't find any information regarding the method 'get_LockReleaseBehavior' online, so I'm a bit stuck.
I've discovered that the error message mentions version 8.0.23.1, yet I am using version 8.23.60 of Oracle.EntityFrameworkCore in the .csproj configuration. I've tried clearing the NuGet cache using dotnet nuget locals all --clear, but to no avail.
Please note, that in a different solution, that I used as a reference, migrations work just fine.
Various chatbots suggested to me that this error could be due to some bad implementation on the side of the Oracle package, but I find this unlikely and hope that there is just some bug on my side. My hunch is that there might be some conflict between the different packages, but if that doesn't resolve my issue, I'm out of ideas.
Upvotes: 1
Views: 2317
Reputation: 157
Ran to this issue in Postgres and it is a result of incompatible mixing of packages make sure packages are aligned.
Upvotes: 0
Reputation: 607
I ran into the same issue with Postgres. I've rolled back my EF assemblies to 8.0.11 as well, and everything's working again. Guess we'll just have to keep an eye on the packages in the next few weeks to see if they fix it.
Upvotes: 2
Reputation: 61
I've figured out a solution. The problem was in the new version of Microsoft.EntityFrameworkCore (version 9). When I set it to version 8.0.10 across my projects, migrations started working again.
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
Upvotes: 1