This project has moved and is read-only. For the latest updates, please go here.

Help for Configuration VS2015

Mar 23, 2016 at 7:19 AM
Even I could not configure the Microsoft Access DB Entity Framework Provider enabling First in VS2015, is there any example video or more explicit steps with pictures? , thank you very much in advance
Mar 23, 2016 at 9:51 AM
What do you mean for First? Db First or Code First?
There are some (registration) problems about Db First and you need to read suggestion and try. If you can solve please let me now how so I can add your suggestions here. You need the source code to do this.
About Code First, you could start downloading the compiled version using NuGet.
Apr 29, 2016 at 4:06 AM
I am following the steps from Documentation / DB Enabling First in VS 2015 and Office 2016 (File .accdb), at the end of the steps, in my Project try to add "ADO.NET Entity Data Model", then select "EF Disigner from DataBase" , wanting select Data Source, the dialog box does not show the "Microsoft Access Database file" option only displays "Microsoft SQL Server" and "Microsoft SQL Server Database file", therefore I can not connect my file. accdb.

I hope you can help me, thank you very much in advance.
May 17, 2016 at 3:45 PM
The Microsoft Access Database engine needs to be installed on your system in order for this to work. It should be automatically installed if you have the Access Application on your system. If not, you can download it for free from the Microsoft Website. You then need to adjust your string connection in order to match the version you have installed.

Let me know if you need more help.
Saludos!
Jul 11, 2016 at 8:53 PM
Edited Jul 11, 2016 at 9:00 PM
I have exactly the same problem as Ernesto described. MS Access Application is installed with Office Pro 2016.

Do you have any more help?


What is meant with the following step in documentation "Enabling db First"
"2. Sign the JetEntityFrameworkProvider
I usually enable it from visual studio. You can also find a test key inside the project
"


And the last step in the same documentation
"5. Register DDEX provider (the Visual Studio provider).
To do it run install.cmd (as Administrator) inside JetDdexProvider directory
"
Do I need a parameter codebase?
How can I check the successful installation?
Jul 13, 2016 at 7:33 AM
Hi Herald,

to sign the provider you can select Project -> Properties -> Signing then check Sign the assembly and select the key file (you can find one in the directory).
In your case, to register the DDEX provider you need to run install.cmd (inside a command prompt with administrative privileges) specifying a different regroot (probably SOFTWARE\Microsoft\VisualStudio\13.0_Config but I don't have Visual Studio 2015 to check it).

To see if everything worked just run Visual Studio and try to create an EF6 project. If you can see the Jet DDEX provider it worked...
Jul 14, 2016 at 3:19 PM
Edited Jul 14, 2016 at 3:21 PM
Thanks for the quick response, bubibubi.
But I still cant't see any other provider than "Microsoft SQL Server" and "Microsoft SQL Server Database file".

In step 1 of your documentation you wrote to install "Entity Framework 6 Tools for Visual Studio 2012 & 2013". These tools are not offered for VS 2015. What to do?

Due to step 5 of your documentation I've registered the DDEX provider with:
install /regroot SOFTWARE\Microsoft\VisualStudio\14.0_Config /codebase g:\VSproject\jetEFprovider\JetDdexProvider\bin\Debug\JetDdexProvider.dll
Is it correct, to set the codebase to the JetDdexProvider.dll?
Jul 14, 2016 at 4:04 PM
In your JetEntityFrameworkProvider.Test and JetEntityFrameworkProvider.Test.DbFirst projects (and only there) I am able to select the Jet DDEX Provider while creating an EF6 DbFirst model.

But after inserting the connection string (with successful test connection), I got an error "failed to find or load the registered .net framework data provider" after click on OK.
Jul 14, 2016 at 7:05 PM
I need to install Visual Studio 2015 to make some tests.
I will be able to do it during August.
Sorry, I can't help you more now...
Sep 13, 2016 at 7:03 PM
When you add the line into machine.config you need to ensure the assembly file version of the file as built matches the string you are entering. the string if just copied from this website would read Version=1.0.0.0. At the time of writing I changed the string to:

<add name="JetEntityFrameworkProvider" invariant="JetEntityFrameworkProvider" description="JetEntityFrameworkProvider" type="JetEntityFrameworkProvider.JetProviderFactory, JetEntityFrameworkProvider, Version=1.2.4.0, Culture=neutral, PublicKeyToken=756cf6beb8fe7b41" />
Sep 13, 2016 at 7:30 PM

Unfortunately I have found another error:

Microsoft Visual Studio

An error occurred while connecting to the database. The database might be unavailable. An exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred. The error message is: 'The store data provider failed to return information for the StoreSchemaDefinition request. See the inner exception for details.

The inner exception caught was of type 'System.ArgumentException', with this error message: 'Unknown db information 'StoreSchemaDefinition'.

Parameter name: informationType'.'.

OK

I have specified my connection string as follows:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\projects\jetentityframeworkprovider\JetEntityFrameworkProvider.Test\Test.mdb

The error occurs in VS2015 in the Entity Data Model Wizard having setup the connection, verified that it is valid and then clicking next.

The screen reads:

Choose Your Data Connection
Which data conenction should your application use to connect to the database

Connection String:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\projects\jetentityframeworkprovider\JetEntityFrameworkProvider.Test\Test.mdb

Save connection settings in App.Config as Model1

Any advice would be most appreciated.
Sep 14, 2016 at 6:54 AM
Thanks for your suggestions.

Your connection string should be fine.
I committed a fix for your issue but I'm not sure it works.
I hope that with your suggestions I can use VS2015 so I can make some test.
Meanwhile please let me know if the fix works.
Sep 14, 2016 at 2:27 PM
We are making some progress. But I have another error:
Connection String:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\projects\jetentityframeworkprovider\JetEntityFrameworkProvider.Test\Test.mdb

Microsoft Visual Studio

An error occurred while connecting to the database. The database might be unavailable. An exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred. The error message is: 'Schema specified is not valid. Errors: StoreSchemaDefinition(175,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(176,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(177,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(178,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(185,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(186,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(187,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(190,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(195,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(196,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(197,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(198,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(199,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(200,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(204,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(211,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(212,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(213,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(214,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(215,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(223,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(224,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(225,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(228,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(233,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(234,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(235,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(236,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(237,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(238,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(242,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(249,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(250,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(251,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(252,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(253,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(258,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(259,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(260,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(261,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(262,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(263,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(275,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(276,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(277,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(278,6) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(285,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(286,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

StoreSchemaDefinition(287,6) : error 0040: The Type nvarchar(max) is not qualified with a namespace or alias. Only primitive types can be used without qualification.

... [Message truncated but doesn't include anything that isn't already described above]
Sep 14, 2016 at 3:42 PM
this looks a lot like the stuff discussed here:

http://stackoverflow.com/questions/22262817/mysql-5-6-with-entityframework-6-schema-error-0040

Access MDB doesn't support nvarchar but it does support text.
I'd consider looking at the Access field types conversion, and see if those are correct.

What version of Access if your test.mdb? that may be a key a well.

Dave
Sep 14, 2016 at 3:50 PM
@dadolson, the stack overflow article is related to code first and the provider should work fine with code first (I use it dayly).
Sep 14, 2016 at 3:51 PM
check out what i found, may be wrong but
JetEntityFrameworkProvider project, 
  JetStoreSchemaDefinitionRetrieve.cs 
        method    private static string ConvertToJetDataType(int intOleDbType, int intFlags)    at line 577 ( or close to it)
Question since no nvarchar is defined in this so wouldn't this create the conversion error?


Dave
Sep 14, 2016 at 3:56 PM
@wrightsonm

About the errors,
The store scheda definition is stored in an xml file (JetProviderServices.StoreSchemaDefinition.xml).
In there you can find the statements to retrieve informations about schema and the schema definition tables.
The schema was ok with visual studio 2013. Probably with Visual Studio 2015 there is something different.
You could start changing nvarchar(max) to text and nvarchar to varchar.
Please let me know if it works.

As soon as I have some minutes I'll work on it again.
The problem is that actually I use only code first and in this case the provider works very fine.
Sep 14, 2016 at 4:02 PM
@dadolson

Actually I don't know...
The class is required to retrieve schema definition and I added (invented) some SQL Statements and some table structures to retrieve it.
With VS 2013 it was fine.
Probably now VS checks also the table structures types.

About the function you posted should be ok but to understand if it's really ok you should debug visual studio inside another visual studio (I developed all the db first provider in this way) and try to understand what's happening (provider calls are undocumented)
Sep 14, 2016 at 6:33 PM
At the moment I am using the test.mdb file as provided in this project:

jetentityframeworkprovider\JetEntityFrameworkProvider.Test\Test.mdb

This appears to be Access 2000 format.

I haven't even tried to use one of my own mdb files yet.

I haven't tried using CodeFirst. I have a DB that I 'd like to import. It is unfortunate that the JetEntityFrameworkProvider.Test.DbFirst test project is almost completely empty other than a blank WinForm.
Sep 15, 2016 at 4:55 PM
Edited Sep 15, 2016 at 4:56 PM
Ok, I'm restart working on it.

I think that the first problem is this


https://entityframework.codeplex.com/wikipage?title=Rebuilding%20EF%20providers%20for%20EF6

In older versions of EF the DbProviderServices implementation to use was obtained directly from an ADO.NET provider. This was done by casting DbProviderFactory to IServiceProvider and calling the GetService method. This tightly coupled the EF provider to the DbProviderFactory. This coupling blocked EF from being moved out of the .NET Framework and therefore for EF6 this tight coupling has been removed and an implementation of DbProviderServices is now registered directly in the application’s configuration file or in code-based configuration as described in more detail the Registering DbProviderServices section below.

I'm still deploying DbProviderServices in ProviderFactory (JetProviderFactory.GetService) as required in EF 5
This could be a problem.
Sep 16, 2016 at 6:53 AM
@wrightsonm, finally I could reproduce your error!

I should have compiled the test project then Visual Studio stops call JetProviderFactory.GetService.
Sep 16, 2016 at 10:48 AM
I made a lot of debug on Visual Studio and EF DB First
I could make the interface between Jet EF Provider and Visual Studio work but after that, Visual Studio, to retrieve schema informations, uses EF itself.
The problem about this is that EF generates "the tipical ugly queries" on schema tables.
For example:

SELECT 
[UnionAll1].[Ordinal] AS [C1], 
[Extent1].[CatalogName] AS [CatalogName], 
[Extent1].[SchemaName] AS [SchemaName], 
[Extent1].[Name] AS [Name], 
[UnionAll1].[Name] AS [C2], 
[UnionAll1].[IsNullable] AS [C3], 
[UnionAll1].[TypeName] AS [C4], 
[UnionAll1].[MaxLength] AS [C5], 
[UnionAll1].[Precision] AS [C6], 
[UnionAll1].[DateTimePrecision] AS [C7], 
[UnionAll1].[Scale] AS [C8], 
[UnionAll1].[IsIdentity] AS [C9], 
[UnionAll1].[IsStoreGenerated] AS [C10], 
IIf([Project5].[C2] IS NULL, false, [Project5].[C2]) AS [C11]
FROM ( ( (
          SHOW TABLES
      ) AS [Extent1]
INNER JOIN  (SELECT 
    [Extent2].[Id] AS [Id], 
    [Extent2].[Name] AS [Name], 
    [Extent2].[Ordinal] AS [Ordinal], 
    [Extent2].[IsNullable] AS [IsNullable], 
    [Extent2].[TypeName] AS [TypeName], 
    [Extent2].[MaxLength] AS [MaxLength], 
    [Extent2].[Precision] AS [Precision], 
    [Extent2].[DateTimePrecision] AS [DateTimePrecision], 
    [Extent2].[Scale] AS [Scale], 
    [Extent2].[IsIdentity] AS [IsIdentity], 
    [Extent2].[IsStoreGenerated] AS [IsStoreGenerated], 
    0 AS [C1], 
    [Extent2].[ParentId] AS [ParentId]
    FROM (
        SHOW TABLECOLUMNS
      ) AS [Extent2]
UNION ALL
    SELECT 
    [Extent3].[Id] AS [Id], 
    [Extent3].[Name] AS [Name], 
    [Extent3].[Ordinal] AS [Ordinal], 
    [Extent3].[IsNullable] AS [IsNullable], 
    [Extent3].[TypeName] AS [TypeName], 
    [Extent3].[MaxLength] AS [MaxLength], 
    [Extent3].[Precision] AS [Precision], 
    [Extent3].[DateTimePrecision] AS [DateTimePrecision], 
    [Extent3].[Scale] AS [Scale], 
    [Extent3].[IsIdentity] AS [IsIdentity], 
    [Extent3].[IsStoreGenerated] AS [IsStoreGenerated], 
    6 AS [C1], 
    [Extent3].[ParentId] AS [ParentId]
    FROM (
        SHOW VIEWCOLUMNS
      ) AS [Extent3]) AS [UnionAll1] ON (0 = [UnionAll1].[C1]) AND ([Extent1].[Id] = [UnionAll1].[ParentId]))
LEFT OUTER JOIN  (SELECT 
    [UnionAll2].[Id] AS [C1], 
    true AS [C2]
    FROM ( (
        SHOW CONSTRAINTS
      ) AS [Extent4]
    INNER JOIN  (SELECT 
        7 AS [C1], 
        [Extent5].[ConstraintId] AS [ConstraintId], 
        [Extent6].[Id] AS [Id]
        FROM ( (
        SHOW CONSTRAINTCOLUMNS
      ) AS [Extent5]
        INNER JOIN (
        SHOW TABLECOLUMNS
      ) AS [Extent6] ON [Extent6].[Id] = [Extent5].[ColumnId])
    UNION ALL
        SELECT 
        11 AS [C1], 
        [Extent7].[ConstraintId] AS [ConstraintId], 
        [Extent8].[Id] AS [Id]
        FROM ( (
        SHOW VIEWCONSTRAINTCOLUMNS
      ) AS [Extent7]
        INNER JOIN (
        SHOW VIEWCOLUMNS
      ) AS [Extent8] ON [Extent8].[Id] = [Extent7].[ColumnId])) AS [UnionAll2] ON (7 = [UnionAll2].[C1]) AND ([Extent4].[Id] = [UnionAll2].[ConstraintId]))
    WHERE [Extent4].[ConstraintType] = 'PRIMARY KEY' ) AS [Project5] ON [UnionAll1].[Id] = [Project5].[C1])
WHERE (((([Extent1].[CatalogName] LIKE @p0) AND ([Extent1].[SchemaName] LIKE @p1)) AND ([Extent1].[Name] LIKE @p2)) OR ((([Extent1].[CatalogName] LIKE @p3) AND ([Extent1].[SchemaName] LIKE @p4)) AND ([Extent1].[Name] LIKE @p5))) OR ((([Extent1].[CatalogName] LIKE @p6) AND ([Extent1].[SchemaName] LIKE @p7)) AND ([Extent1].[Name] LIKE @p8))
The problem with Jet is that Jet does not have system tables so the provider implements it (see SHOW statement in the query).
To fully implement DBFirst I should interpret and execute this and other similar queries (and not only interpret SHOW statements as I'm doing now).
Probably, the best way to implement DBFirst is to use an in memory sql dbms and solve queries with it.

For now I have to give up.
Sep 16, 2016 at 11:04 AM
Edited Sep 16, 2016 at 11:18 AM
Another possible solution?

In this article seems that a provider can provide schema informations (avoiding EF system tables access).

https://entityframework.codeplex.com/wikipage?title=Schema%20Information

EDIT
It seems that is a preliminary documentation of a non implemented feature