Home

InvalidOperationException with EFCore 5 connection that uses Pomelo driver and DbContextOptions

I am trying to utilize a saved connection I have to a context that uses EFCore 5 with the current alpha of the Pomelo.EntityFrameworkCore.MySql driver (version 5.0.0-alpha.2 as of this writing).

When I use a constructor that accepts a string, everything works fine (although I've noticed that I cannot see the value of parameters in the SQL tab, it always shows ='?' for any of the parameters under Region Parameters).

But when I use a constructor that accepts DbContextOption, I will instead get the following exception:

InvalidOperationException: Cannot locate type Microsoft.EntityFrameworkCore.MySqlDbContextOptionsExtensions in assembly C:\Users\cyber\.nuget\packages\Pomelo.EntityFrameworkCore.MySql\5.0.0-alpha.2\lib\netstandard2.1\Pomelo.EntityFrameworkCore.MySql.dll.

with a stack trace of:

   at LINQPad.Drivers.EFCore.OptionsBuilderBuilder.Create(IConnectionInfo cxInfo, String assemblyFilename, String typeWithUseMethod, String methodName, String optionsBuilderType)
   at LINQPad.Drivers.EFCore.OptionsBuilderBuilder.ForMySQLPomelo(IConnectionInfo cxInfo)
   at LINQPad.Drivers.EFCore.OptionsBuilderBuilder.Get(IConnectionInfo cxInfo)
   at LINQPad.Drivers.EFCore.StaticDriver.GetContextConstructorArguments(IConnectionInfo cxInfo)

This only started to happen once I switched to the alpha Pomelo driver to use EFCore 5. I have no issues with using the DbContextOptions constructor outside of LINQPad.

Comments

Sign In or Register to comment.