Single DAL interface for 2 objects - violation of Single Responsability?

Single DAL interface for 2 objects - violation of Single Responsability?

Old forum URL: forums.lhotka.net/forums/t/10099.aspx


tiago posted on Wednesday, February 23, 2011

Hi Rocky,

On Using CSLA 4: Data Access you use a single DAL interface and thus a single class for handling the persistence of two objects: PersonEdit and PersonList.

Isn't this a violation of the Single Responsability principle?

Anyway, why use a single DAL class?

RockfordLhotka replied on Wednesday, February 23, 2011

The DAL interfaces are providing services for a data entity, not for a business object.

PersonEdit and PersonList are business objects with separate responsibilities, but they both use data from the underlying "person data entity", and that's a singular concept.

The IPersonDal DAL interface is focused on the data entity, not the business object(s).

You might look at this differently, and have different DAL interfaces for each business object. That's also a valid perspective on the problem. I just don't typically approach it that way.

Copyright (c) Marimer LLC