Follow up on “Reducing ORM Friction” by Rob Conery
In my development process I do use what Rob is describing in his post “Crazy Talk: Reducing ORM Friction” with some slight differences.
For example I developed Tech Head Brothers portal this way, as Innoveo Solutions web site. I use TDD and Domain Driven Development and I keep the mapping as one of the last step for my implementation.
I do have a generic Repository interface as following:
using System;
using System.Collections.Generic;
using System.Linq;
namespace TechHeadBrothers.Portal.Infrastructure.Interfaces
{
///
/// IRepository exposes all methods to access the data repository
///
public interface IRepository
{
void InitializeRepository();
bool Save
bool SaveAll
bool Delete
T Find
IQueryable
IQueryable
IQueryable
int Count
int Count
}
}
My ORM mapping tool of choice is Euss. And here comes the slight difference, I do have one implementation of my interface leveraging Euss, and that’s it. All different possibilities are handled by Euss. During my work on the definition of the domain I took the habit to use an Euss XML Engine or an Euss Memory Engine. I use those two engine for my unit test and my real application.
Following the lean principle I postpone the choice of the data repository till the last minute, when I know more about the real need. So it really happen that I stay with an XML Engine so that all my data are stored in an XML file. If I need more I go to an Euss SQL Mapper Engine and then define the mapping.
So I moved to the ORM framework the different implementations.
Now I am still free to go to another ORM, or something else, by using the interface IRepository.
I used several time this technique and I am currently happy about it.