Sunday, December 30, 2007 3:02 PM
[Edit]
This post has generated a lot of buzz, spawned some great discussion and even a full length article on how to set up Sub Sonic as a stand-alone assembly. For the reader stumbling on this post via Google or what not, please ensure you read the full comments on this post. Also, ensure that you check out Willie's tutorial on how to set Sub Sonic as a standalone DAL.
Finally, to see how this ended up and where the conversation is leading, check out my follow up post here.
D'Arcy - January 4/2008
[/Edit]
I've become disenchanted with Sub Sonic. Well...not entirely disenchanted: what it does it does very well. If you want to couple your web application's DAL and Logic tiers into the same web-app assembly, with only namespaces acting as logical borders to the components, then go nuts. Sub Sonic is definately the tool for you.
But although I've appreciated using Sub Sonic's ability to create my DAL and entity objects quickly, there's one glaring issue that is just a huge problem for me...HUGE...as in, deal breaker. As in, if you want to architect an application with proper separation of responsibilities, you just can't do it with Sub Sonic.
I wanted to take my generated classes and put them into a separate assembly library. Why? Seriously, you're asking that? You shouldn't...you should know that you should ensure that all your code is highly cohesive and loosely coupled...you should make sure that your UI layer doesn't know anything about the database implementation, providers required, or connection string. For that matter, your business/logic/whatever-you-call-it tier shouldn't know any of the database stuff either...that's why it's called a DAL: its the DATA ACCESS LAYER.
Ok...rant done.
So I've been beating my head on my desk because for the life of me I can't realize why I keep getting the error:
"Can't find the SubSonicService in your application's config"
What do you mean you can't find it?! It's right there...I can see it...the section is THERE.
Alas, it matters not...because it will never read it from there. It will never look there, it doesn't even care that there's a config file associated with the library.
All it knows is that it needs to find the SubSonicService section in the Web.Config section. This was cemented by a post I found on the SubSonic forum where "spookytooth"...
[Edit] ahem...who happens to be "Rob"...who happens to be the main guy *behind* Sub Sonic...yeah...[/Edit]
who happens to be a SubSonic team member as well as on the ASP.NET team, clarified that indeed the execution environment is the web, and therefore the SubSonic dataservice will be looking for a web.config file to pull the values out.
[Edit] Took out this part because it was a misunderstanding between what I *thought* Rob was trying to say and what he meant...he explained it in the comments. [/Edit]
Look, SubSonic is a great tool if you want to create a web or windows based application that you fully expect to be tightly coupled with the data access and entity layers. But if you're looking for something with more flexibility, you're better off using other code generation tools that do the same thing as SubSonic without handcuffing you to their data service components.
[Note: strong ending statement...read the comments below for the full conversation]
D