entity-framework-corejet-ef-provider

OleDbException Microsoft Access cannot find MSysAccessStorage


My project uses EntityFrameworkCore.Jet.OleDb v3.1 with provider in connection string Provider=Microsoft.ACE.OLEDB.12.0. The code's go through several iterations including RemoveRange followed by AddRange. Currently it's this

boards.ForEach((board) =>
{
    if (_cutriteDbContext.Boards.Any(i => i.BoardsCode == board.BoardsCode))
    {
        _cutriteDbContext.Boards.Update(board);
    }
    else
    {
        _cutriteDbContext.Boards.Add(board);
    }
});

I'm getting an error that says it can't find MSysAccessStorage when it reaches the .Boards.Any(). Is this because the DB files are too old maybe? Has anyone encountered this? EDIT: Is there a way to specify compatibility with EntityFrameworkCore.Jet.OleDb in the DbContextOptions?

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request. System.Data.OleDb.OleDbException (0x80040E37): The Microsoft Access database engine cannot find the input table or query 'MSysAccessStorage'. Make sure it exists and that its name is spelled correctly. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at EntityFrameworkCore.Jet.Data.JetCommand.ExecuteDbDataReaderCore(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.InitializeReader(DbContext _, Boolean result) at EntityFrameworkCore.Jet.Storage.Internal.JetExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.MoveNext() at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.Any[TSource](IQueryable1 source, Expression1 predicate) at CutriteAPI.Repositories.CutriteRepository.<SyncBoards>b__3_1(Board board) in C:\Users\mbaker\source\repos\CutriteAPI\CutriteAPI\Repositories\CutriteRepository.cs:line 43 at System.Collections.Generic.List1.ForEach(Action1 action) at CutriteAPI.Repositories.CutriteRepository.SyncBoards(List1 boards) in C:\Users\mbaker\source\repos\CutriteAPI\CutriteAPI\Repositories\CutriteRepository.cs:line 41 at CutriteAPI.Controllers.CutriteAPIController.SyncBoards(CUT_RITE_FILE cUT_RITE_FILE) in C:\Users\mbaker\source\repos\CutriteAPI\CutriteAPI\Controllers\CutriteAPIController.cs:line 94 at CutriteAPI.Controllers.CutriteAPIController.SyncLibrary(CUT_RITE_FILE cUT_RITE_FILE) in C:\Users\mbaker\source\repos\CutriteAPI\CutriteAPI\Controllers\CutriteAPIController.cs:line 78 at lambda_method(Closure , Object ) at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


Solution

  • You can create MSysAccessStorage with a single column and a single record. It's used for certain queries just to have one record (see Oracle DUAL table). You can also change the name of this table (it's an ef provider for jet configuration property)