tags:

views:

395

answers:

3

I've gone back and forth on this problem and can't seem to figure out the best way to do this.

Here's the situation:

  • Access database (3rd party product) with data I need in it, from a good number of tables (18 tables)
  • Ideally, need to try to get records into strongly-typed objects somehow so I can query around with LINQ
  • LINQ to SQL classes don't support ODBC provider (this would have gotten me home free)
  • I do NOT need to insert/update/delete. Only select/read.

I've toyed around with the idea of just exporting the tables to XML (it's not that much) but then I'm still faced with the problem of building the schema and generating the classes. Since it's an ODBC source there should be a way to ORM this, right?

How would you solve this?

+2  A: 

You can do this using nHibernate, since it supports MS Access as a backend. Here are the details of using nHibernate with MS Access. It uses NHibernate.JetDriver.dll to access the Jet data engine (MS Access).

Just realize that MS Access isn't going to give you the same performance/support/etc as most other DB backends with an ORM.

Reed Copsey
You don't happen to know an alternate download URL to get the JetDriver.dll do you? (NHibby's site appears to be down)
routeNpingme
I believe you can get everything from: http://sourceforge.net/project/shownotes.php?release_id=460590
Reed Copsey
A: 

I just answered my own question...

I can just establish the ODBC connection in Server Explorer, and drag the tables straight into a predefined DataSet and use a TableAdapter.Fill()

routeNpingme
That's not really an ORM, though - just standard data access. Is that all you really need?
Reed Copsey
I kind of wanted a true ORM, but this gets me into strongly typed objects for read-only access, so I'm good...
routeNpingme
If you want a true ORM, nHibernate's probably your best option. THere are some commercial options that work, as well - not sure if spending $ is an option or not, here, though.
Reed Copsey
A: 

Hi The dll for using NHibernate to Acccess seems to be on sourceForge (just googling, not checking)
http://sourceforge.net/project/shownotes.php?release_id=460590
If you are just querying access, it might be worth defining views in a relationnal database This way you will have a solution for using a form of cache/snapshot later on(for example by converting your views into table that you refresh each hour/ 5min. etc depending on your expectations) if the performance degrade too much.

Dom Ribaut