onion-architecture

Repository pattern and mapping between domain models and Entity Framework

落爺英雄遲暮 提交于 2019-11-27 17:03:31
My repositories deal with and provide persistence for a rich domain model. I do not want to expose the anemic, Entity Framework data entity to my business layers, so I need some way of mapping between them. In most cases, constructing a domain model instance from a data entity requires the use of parameterised constructors and methods (since it is rich). It is not as simple as a property/field match. AutoMapper could be used for the opposite situation (mapping to data entities) but not when creating domain models. Below is the core of my repository pattern. The EntityFrameworkRepository class

Onion Architecture, Unit of Work and a generic Repository pattern

被刻印的时光 ゝ 提交于 2019-11-27 10:22:55
问题 This is the first time I am implementing a more domain-driven design approach. I have decided to try the Onion Architecture as it focuses on the domain rather than on infrastructure/platforms/etc. In order to abstract away from Entity Framework, I have created a generic repository with a Unit of Work implementation. The IRepository<T> and IUnitOfWork interfaces: public interface IRepository<T> { void Add(T item); void Remove(T item); IQueryable<T> Query(); } public interface IUnitOfWork :

What are the typical layers in an onion architecture?

与世无争的帅哥 提交于 2019-11-27 05:41:09
问题 I am currently studying the domain driven design, and try to apply it for a WPF project. I watched some tutorial videos, and read many articles, like : Onion archicecture dependencies in the same layer: Infrastructure and Web communicating http://eohmicrosoft.blogspot.fr/2012/08/laying-it-out-onion-architecture.html Domain Driven Design: Domain Service, Application Service I understood the focus on interfaces and inversion of control. I read there were some recurrent layer names (domain/core

How can I solve this NHibernate Querying in an n-tier architecture?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 21:04:20
问题 I've hit a wall with trying to decouple NHibernate from my services layer. My architecture looks like this: web -> services -> repositories -> nhibernate -> db I want to be able to spawn nhibernate queries from my services layer and possibly my web layer without those layers knowing what orm they are dealing with. Currently, I have a find method on all of my repositories that takes in IList<object[]> criteria . This allows me to pass in a list of criteria such as new object() {"Username",

Repository pattern and mapping between domain models and Entity Framework

只愿长相守 提交于 2019-11-26 18:53:55
问题 My repositories deal with and provide persistence for a rich domain model. I do not want to expose the anemic, Entity Framework data entity to my business layers, so I need some way of mapping between them. In most cases, constructing a domain model instance from a data entity requires the use of parameterised constructors and methods (since it is rich). It is not as simple as a property/field match. AutoMapper could be used for the opposite situation (mapping to data entities) but not when