2

I am using the JetEntityFrameworkProvider. I am trying to connect to an MS Access file (it has ext .sep but it is indeed an Access file).

I am trying to define the connection string and provider in code, but it is not working. Before I run I get the following error:

Unable to determine the provider name for provider factory of type 'JetEntityFrameworkProvider.JetProviderFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.

I do not wish to configure the provider in the config. Surely there is a way to do this.

When I do run it (yes it will build), I get this error:

System.InvalidOperationException: 'The 'Jet OLEDB:Database' provider is not registered on the local machine.'

Context class

public class ProjectContext : DbContext
{
    private DbConnection con = new JetConnection();

    public ProjectContext() : base(new JetConnection(""Provider=Microsoft.ACE.OLEDB.12.0;Data Source='C:\\Test-Project.sep'; Provider=Jet OLEDB:Database; Password=SEEME;""), true)
    {
    }

    public DbSet<Component> Components { get; set; }
}

Entity class

public class Component
{
    [Key]
    [Column("Counter")]
    public int Id { get; set; }
    [Column("Name")]
    public string Name { get; set; }
}
0

1 Answer 1

1

I solved this by changing the connection string to this.

public ProjectContext() : base(new JetConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='C:\Test-Project.sep'; providerName=JetEntityFrameworkProvider; Password=SEEME;"), true)
{

}

However, I have a new problem and a new error so I will post a new question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.