20
votes

Has anyone found a way to make the ADO.NET Entity Framework work with OLE DB or ODBC data sources? Specifically, I need to work with an Access database that for various reasons can't be upsized to SQL.

This MSDN page says:

The .NET Framework includes ADO.NET providers for direct access to Microsoft SQL Server (including Entity Framework support), and for indirect access to other databases with ODBC and OLE DB drivers (see .NET Framework Data Providers). For direct access to other databases, many third-party providers are available as shown below.

The reference to "indirect access to other databases" is tantalising but I confess that I am hopelessly confused by all the different names for data access technology.

3
I couldn't find a way to do it. - John Saunders
This is outside my bailiwick, but have you consider mounting the Access/Jet/ACE database as a linked server in SQL Server, and then utilizing the SQL Server provider? That would be the way I'd read the reference to "indirect access." - David-W-Fenton
I'm pretty sure the "(including Entity Framework support)" bit applies only to SQL Server insofar as the MS provider goes. Linked server might be worth a shot. - Craig Stuntz

3 Answers

1
votes

To the best of my knowledge, this is not possible using an entity framework. You can however, use linq to dataset to access your Access (no pun intended) database.

http://msdn.microsoft.com/en-us/library/bb386977.aspx

1
votes

EF cannot use OLE DB directly because an EF provider have to translate c# into specific SQL syntax (OLE DB is a connection to several DBMSs with several SQL syntaxes).

If you need an EF 6.1 provider for MS Access you can have a look here https://jetentityframeworkprovider.codeplex.com/

0
votes

I am not so sure about using Access with EF in particular, but it does seem possible to use linq with access. http://social.msdn.microsoft.com/Forums/en/adodotnetentityframework/thread/985a1048-cf56-4bb0-b664-61fbf4957890