Entity Framework Core and MS Access

c# entity-framework-core jet-ef-provider ms-access

Question

I'm attempting to use an Access database from a WPF MVVM application using JetEntityFrameworkProvider and I can't get it to work. I've created the models, created the migrations using Add-Migration but when I run Update-Database, the command never finishes. It does create the database but the only table is MSysAccessStorage. There is a section of the documentation that says

In order to make the provider work, the table MSysRelationships should be accessible from Administrator

and further says

This is the default configuration so no needs to make changes. Access since version 2003 has visible system tables so no need to assign rights. The configuration must be done setting the right dual table (very early in your code).

JetConnection.DUAL = JetConnection.DUALForAccdb;

I've tried adding this but I can't figure out where "very early in your code" is. I've added it to the top of my App.xaml.cs and to my database context and neither worked. When I add it I get:

The name 'DUAL' does not exist in the current context. The name 'JetConnection.DUALForAccdb' does not exist in the current context.

This is my OnConfiguring in my context

protected override void OnConfiguring( DbContextOptionsBuilder optionsBuilder )
{
    optionsBuilder.UseJet( @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\<User>\Desktop\New Folder\Staff.accdb;" );
}

What am I not doing correctly?

1
2
12/24/2018 6:03:41 PM

Popular Answer

The JetEntityFramework provider is not compatible with EF Core.

Instead, use EntityFrameworkCore.Jet if you want to use EF Core (same author as JetEntityFramework, not affiliated), or use EF 6 if you want to use JetEntityFramework.

1
12/21/2018 3:59:53 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow