<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=12803833&amp;blogName=thomasnguyen.com&amp;publishMode=PUBLISH_MODE_FTP&amp;navbarType=TAN&amp;layoutType=CLASSIC&amp;homepageUrl=http%3A%2F%2Fwww.thomasnguyen.com%2Fblog%2F&amp;searchRoot=http%3A%2F%2Fblogsearch.google.com%2F" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" title="Blogger Navigation and Search"></iframe> <div></div>
home blog contact

SqlException: Invalid object name.
Thursday, July 10, 2008
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?

Labels: , ,



1 Comments

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. Blogger Garo Yeriazarian  

Add a comment





Recent Posts
System.OverflowException!!!
Vacation in Chicago, IL.
Studying for the GMAT.
SVNMigration Project.
Santa Marta, Colombia - 5/5.
Santa Marta, Colombia - 4/5.
Santa Marta, Colombia - 3/5.
Santa Marta, Colombia - 2/5.
Santa Marta, Colombia - 1/5.
MMS2008 - Las Vegas, NV.

Archives
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008
February 2008
March 2008
April 2008
May 2008
June 2008
July 2008
August 2008
September 2008
October 2008

Blogger
copyright 2006-2008 | thomasnguyen.com

Google Reader flickr del.icio.us nike+