Onion Architecture – Repository Vs Service?

The repository is not a gateway to access Database. It is an abstraction that allow you to store and load domain objects from some form of persistence store. (Database, Cache or even plain Collection). It take or return the domain objects instead of its internal field, hence it is an object oriented interface. It is … Read more

Onion archicecture dependencies in the same layer: Infrastructure and Web communicating

You are correct that you don’t want Infrastructure to depend on UI(Web), but I break that rule sometimes. I would think instead of IViewModelMapping, create IMapper with method Map(). Then, the interface can have implementations that might have to do with view model mapping, or maybe just regular mapping. Either way, that interface can be … Read more

Onion vs. N-Layered Architecture

Adding facades are really the first step in building an onion architecture out of an n-layered architecture. So, yes, you can get many of the benefits right away. Testing is still problematic as you need to invert the dependency control. Controlling what has the facade is pointing to needs to move to the consumer, not … Read more

What is the relationship between DDD and the “Onion Architecture”?

In my opinion – they complement each other – but from very different perspectives. Onion Architecture is all about making the Domain/BusinessLogic independant on ‘inferior’ things like data-acccess, UI, services etc. The Onion Architecture doesn’t really care how you made the domain you have – it’s adamant about protecting it from outside dependencies. Domain Driven … Read more

Repository pattern and mapping between domain models and Entity Framework

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. If you you use Entity Framework, it can map Rich Domain Model itself. I’ve answered the similar question … Read more

Onion architecture compared to hexagonal

What are the differences between them if any? Onion: There are layers, with the dependencies always pointing inwards, i.e., a layer can use any of the layers inside it. The inner layer is Domain Model and the outer is infrastructure, but the number of layers between may vary. Hexagonal (it’s an alternative name for the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)