Nov
5
2008
unit test // Euss // ORM // Agile

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

{

    /// <summary>

    /// IRepository exposes all methods to access the data repository

    /// </summary>

    public interface IRepository

    {

        void InitializeRepository();

 

        bool Save<T>(T entity) where T : class;

        bool SaveAll<T>(IList<T> entities) where T : class;

 

        bool Delete<T>(string id) where T : class;

 

        T Find<T>(string id) where T : class;

        IQueryable<T> Find<T>();

        IQueryable<T> DetachedFind<T>();

        IQueryable<T> Find<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression);

 

        int Count<T>();

        int Count<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression);

    }

}

 

 

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.

May
16
2008

Bringing Linq to Euss ORM

Euss stand for Evaluant Universal Storage Services, it's a great open source (MIT License) Object-Relational mapping framework.

I use Euss on Tech Head Brothers portal since a long time now.

Four days ago I went to Sébastien Ros, the architect of Euss, with a first draft implementation of IQueryable<T> for Euss. Almost everything was already implemented but it was missing the IQueryable<T>. Today Sébastien came back to me with a first implementation that I could quickly integrate.

As you can see on the following screenshots, made with NDepend, I was then able to remove the dependency on Euss from my Service Layer.

Before with dependency from TechHeadBrothers.Portal.Services to Evaluant.Uss

 

After without dependency from TechHeadBrothers.Portal.Services to Evaluant.Uss

Great new step!

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect and certified Scrum Master.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent is awarded by Microsoft since Avril 2002: Most Valuable Professional (MVP).

MVP
Certified ScrumMaster
JetBrains Academy Member

My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List