Dynamic dataaccess with Webmatrix Webpages

Today I went to a talk by Hadi Hariri about dynamics which was arranged for the ANUG user group in cooperation with the goto conference. The talk happened to fit very well with the first topic I had planned for my series on Webmatrix Webpages, which is dataaccess.

The talk was about not fearing dynamics, and some of the scenarios where it can provide some benefits over static types. Some of the scenarios Hadi talked about were DTO’s, ViewObjects and for DataAccess, which is exactly what WebMatrix WebPages utilizes.

Læs resten

Battle of the ORM’s – Persistence

The last thing I will compare in this round of Battle of the ORM’s is how NHibernate and the Entity Framework handle persistence. So first of all I want to vent one of my pet peeves, which is the myth of persistence ignorence.

Persistence ignorence is a term used to describe a persistence mecanism that does not contaminate the domain model and hence the business logic. This means that the model can be ignorent of how it is stored and not contain detals about the datastore. I think this a very important design goal to strive for, however actually obtaining true ignorence is a myth and something no ORM is even close to achieving.

Læs resten

Battle of the ORM’s – Querying

Gimme gimme gimme

In the previous Battle of the ORM’s post I looked at setting up and configuring NHibernate and Entity Framework.
So the next step is to get down to business and look at querying – the most important part of an ORM.

First I need to address that the Entity Framework CTP5 has been released. This means that some more features have been added, which you can read about on Scott Guthries blog. Besides that there are some classes that have been renamed, which actually makes my last post mildly obsolete already. The renaming means that the Database class now is called DbDatabase – apparently redundancy is the new black – and that the databaseinitializer classes are called CreateDatabaseIfNotExists, DropCreateDatabaseAlways and DropCreateDatabaseIfModelChanges.

Læs resten

Battle of the ORM’s – Setup and Configuration

Following up on my last post and on reading NHibernate 3.0 Cookbook I decided to download the latest NHibernate bits (v. 3 CR1), and do a comparison to Microsofts Entity Framework. NHibernate and Entity Framework are what most developers reguard as the top Object Relational Mappers out there. So looking at how they stack up is pretty important in order to be able to choose the right ORM for a given project.

Læs resten

Review: NHibernate 3.0 Cookbook

A few weeks ago we got a copy of the NHibernate 3.0 Cookbook by Jason Dentler, which I was really looking forward to because of the scattered nature the existing documentation for NHibernate.

The word Cookbook really says a lot of how the book is structured, and how it should be used. The book consists of a bunch of recipes on how to cook with NHibernate – terrible wordplay, I know, and I am sorry :) So basically it can be a good idea with a quick readthrough, and then it will serve as a place to look up solutions to various scenarios you will be dealing with when using NHibernate.

Læs resten

ORMs, the “Vietnam” of Software Development?…

… not sure myself, but certainly it is a sneaky creature.

I will not talk about all ORMs (as if I could) since I want to exemplify on what gave me grief.
I was using Linq2SQL to perform some “simple” queries in an application.

I wish not to discuss:

  1. whether Linq2SQL is an ORM at all. For me it is and we might discuss its shortcomings and debate o semantics.
  2. why I am using a “walking zombie” of a technology. For me, i is not an “un-dead”. Linq2Sql does the job I am asking it to do efficiently enough (or so I thought) and the bits are not going to vanish all of a sudden from the framework.

My intention is neither debating nor ranting (I do that more than anything apparently), but leaving the grumpy-not-so-old man in me behind and offer the reader some knowledge (for a change).

Læs resten