SqlException: Invalid object name.

SqlException: Invalid object name ‘dbo.sometableName’
Actual name: ‘foo.sometableName’

Mappings for table schema and table names are in the view:

SELECT * FROM INFORMATION_SCHEMA.TABLES

NHibernate: Let users update/modify .hbm.xml file. That’s just too much work to have users set that up on installation.

Manual SQL: Create a class that will hunt down the schema of a table from the view. This just seems ridiculous!

Any ideas to dynamically find the schema of a table?

One thought on “SqlException: Invalid object name.

  1. SubSonic (http://subsonicproject.com/) does it, it will take your database and generate an ActiveRecord pattern DAO layer for you. They just added Migration support in 2.1 too. They abstract the DB-specific stuff into dialects like NHibernate, but they don’t support as many databases as NHibernate. You can take a look at the SubSonic source (MPL 1.1 License) to see how they do it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve this: Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.