Today's sessions that I plan on attending definitely focus on data access, which actually has me excited after the ridiculous models at my last job.
I just got out of Scott Guthrie's keynote on
LINQ.
LINQ definitely has me excited, and I need to play with the release from last year.
Right now I'm in Dave Donaldson's session on
NHibernate. Code with no more stored procedures? Excellent! I'll follow up later with my impressions.
Impressions:Dave has written an interesting framework called
NHibernateRepository that I might look into using. Its not integrated into the
NHibernate project, but Dave said that he's going to eventually look into getting it incorporated into a
contrib project.
I was suspicious of what the performance would be with an O/R mapper, but since
NHibernate uses
parametrized queries, its virtually no different from stored procedures in that respect. From Dave's demo I got the impression that if you need to do tricky things, the way to go about it is using a syntax called
HQL, which looks just like hard coded queries, and weren't we supposed to get away from that?
Differences between
NHibernate and
LINQ were also on my mind.
LINQ has a nice visualizer that shows the actual query when you're debugging, which is a lot nicer than having to use the
profiler or read a log file. It occurred to me when
NHibernate's insert/update/delete features were being demonstrated that I haven't seen any examples of updating data with
LINQ. Is
LINQ supposed to be used solely to query data, and not modify it?
You have to write a lot of configuration and code by hand with
NHibernate .... unless you use a code generator. Dave demonstrated a
CodeSmith template that would (have if it hadn't crashed) create entity classes and
config from your database. But the code still wasn't pleasing to look at. I wondered if, like Dave's
NHibernateRepository library, if anyone has adapted the Data Access Application Block to work with
NHibernate, or another O/R Mapper for that matter.
Another, maybe totally unrelated, thought was "where is the c# in stored procedures?" C# embedded in stored procedures was a feature that was highly touted in .NET 2.0, but I have yet to see anyone use it other than code in
MSDN documentation. Is this feature really something people want to use? Don't we want to stay away from business logic in stored procedures? Yeah.
I'm in Mark
Ramm's session on O/R Mapping with
SQL Alchemy right now, which is definitely outside of my comfort zone. This is what
CodeMash is supposed to be all about, so we'll see how I like it.
Labels: codemash