Tutorial :Forcing subsonic to ignore a certain pattern of column names


We use SubSonic as an ORM of sorts(really more of a query-helper). For one reason or another, we have a bit of a dynamic schema and as such certain tables have generated column names and such. Well, this has been all fine and dandy until now. Now, our production generated columns don't match up with our development generated columns. The first work around that came to mind is just regenerate the subsonic files before deploying to the production servers, but that seems a bit messy. Is there any better way than this?

Note, that these generated columns are never actually used from the ORM but we do sometimes pull down entire rows using

var data=MyData.DynamicTable.SingleOrDefault(x => x.id==1);  

That would throw an error in production though using the development generated subsonic files when trying to load GeneratedColumn10 or whatever, which exists in development but not in production.


I have actually ended up modifying the SQLServer provider so that it checks each column name against a regex to decide if the column should be included or not. It is important to note that you must do this for both columns and for where it looks up the Foreign Keys


You could create your DAL against the production DB and use it with your developement server. Unless your additional columns in the dev environment are not nullable and have no default value specified your update and insert queries will work, too.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »