Category Archives: SubSonic

Migrations for .NET coming in SubSonic

I’m being lazy and just posting a link because I think this feature is that cool:

SubSonic: Migrate Me

If you’ve used Rails you’ll know why this is so cool and if you haven’t then think “A really cool way to version your database schema and all it’s changes and it’s default data.” The Rails kids shouldn’t have all the fun. Read the article, Rob Conery will explain it much better than I ever could.

Plus, he’s been known to use phrases like “The Tits” when describing software features and you just don’t see quality writing like that just anywhere.

Preventing “Could not find schema…” for SubSonic in Visual Studio

My current favorite .NET DAL/ORM solution is SubSonic. It strikes a good balance of being helpful without hindering, partly due to it being heavily inspired by Rails as well as the creator’s focus not only on good code but good architecture and design. Another great thing about the project is that the creator, Rob Conery, does frequent screencasts explaining the nooks and crannies of SubSonic as well as writing informative, engaging and colorful posts over on his blog.

Enough praise though, this post is all about fixing an “issue” that annoys me. SubSonic does part of it’s magic through the SubSonicService, which is a custom configuration section in your web or app config. Since it’s a custom section Visual Studio won’t give you code completion (aka Intellisense) and it’ll spit out a ton of “Could not find schema information for blahblahblah” warnings. These warning are basically saying, “I have no idea what this crap is in the web.config so you get no fancy Intellisense magic from me”. To get back some of that magic here’s all you have to do:

1. Download SubSonicSchema.zip (if you right-click to download make sure you save it with an xsd extension)

2. Put it in C:Program FilesMicrosoft Visual Studio 8.0XmlSchemas

3. Edit DotNetConfig.xsd in the same folder and add the following line:

<xs:include schemaLocation="SubSonicSchema.xsd" />

(I added it right underneath the <xs:schema> opening tag, seems to work)

4. Close Visual Studio if it’s running, re-open, ta-da you now have Intellisense as well as no more annoying “Could not find schema information for…” messages.