Reputation: 3
I am trying to upgrade version of Microsoft.EntityFrameworkCore.SqlServer
to 2.1.1. After upgrading to 2.1.1 I am getting error shown in screenshot on following code of piece marked in bold
var queryCompiler = (IQueryCompiler)_queryCompilerField.GetValue(queryable.Provider);
var queryModelGenerator = (**IQueryModelGenerator**)_queryModelGeneratorField.GetValue(queryCompiler);
var queryModel = queryModelGenerator.ParseQuery(queryable.Expression);
var database = _databaseField.GetValue(queryCompiler);
var queryCompilationContextFactory = ((DatabaseDependencies)_dependenciesProperty.GetValue(database)).QueryCompilationContextFactory;
var queryCompilationContext = queryCompilationContextFactory.Create(false);
var modelVisitor = (**RelationalQueryModelVisitor**)queryCompilationContext.**CreateQueryModelVisitor**();
modelVisitor.CreateQueryExecutor<TEntity>(queryModel);
Upvotes: 0
Views: 190
Reputation: 8008
Error while upgrading Microsoft.EntityFrameworkCore.SqlServer version:
Usually, the type or namespace could not be found error occurs if you are referencing a namespace that is not found by the compiler. It means that when upgrading to later version, the referenced assembly is not installed or if the namespace or type changed in a newer version.
Need to check & resolve:-
Uninstall the package and reinstall it. Rebuilding the solution will sometimes work because it clears all the cache and rebuilds it.
Reload your project in solution explorer (VScode) and modify the .csproj if any package reference exists.
To avoid these errors, change your package reference to Microsoft.AspNetCore.All. All Entity Framework references will be included.
Note: Any other packages that rely on Microsoft.EntityFrameworkCore.SqlServer must be compatible with Microsoft.EntityFrameworkCore.SqlServer version.
Check dependencies here.
Refer MSDoc.
Upvotes: 1