Questions tagged [onion-architecture]

The *Onion Architecture* is a software architecture proposed by Jeffrey Palermo. It is similar to the *Hexagonal Architecture* (Ports and Adapters) proposed by Alistair Cockburn.

Jeffrey Palermo proposed the Onion Arcitecture. It is similar to Alistair Cockburn's Hexagonal Architecture or Ports and Adapters.

The fundamental motivation of the approach is to avoid layer-to-layer dependencies usually associated with the N-tier architecture approach. This is achieved by placing all infrastructure, including databases, outside the problem domain.

According to Jeffrey Palermo:

The overall philosophy of the Onion Architecture is to keep your business logic and model in the middle (Core) of your application and push your dependencies as far outward as possible.

The problem domain is then completely independent of the required infrastructure (testing, databases, security, etc.). For example, this means that testing database accesses can be done thoroughly without a real database.

291 questions
3
votes
1 answer

Onion Architecture and Registering Dependencies in DI Container

I have been reading up on the Onion architecture, and I have what I think is a simple question about how assembly dependencies should be arranged for a DI container to be able to wire everything up. Assume a very simple solution that has the…
3
votes
2 answers

Onion Architecture - what are the layers and where to place the services?

I am learning and working out a sample project applying onion architecture and domain driven design. As per my understanding I have drafted a small presentation and attached as an image in this post. I need clarifications on layers of onion…
3
votes
2 answers

Can infrastructure services return domain entities in Uncle Bob's The Clean Architecture?

Consider: The Use Case layer defines an interface public interface IGeocoder { Coordinate GetCoordinate(Address address); } Coordinate and Address are value objects defined in the domain layer (i.e. entities layer in Uncle Bob jargon).…
3
votes
2 answers

DDD use event or service?

Hi im new to ddd design and is trying to develop my first application using this pattern working in C# In my application i have an aggregate Contract that have child entity assets, when an asset is added or settled i should perform an accounting…
George
  • 33
  • 3
3
votes
1 answer

How bad is it for Domain Models to have a dependency on View Models?

I have inherited some code which is still a work in progress. I think it has a glaring architecture problem: It has a project that contains all the domain entities (domain layer) and a project that contains all the application services (application…
3
votes
1 answer

NLog in Asp.Net Core with Onion Architecture

In a Onion Architecture context, how would I implement NLog in Asp.Net Core? I suppose I'll have to create a separate project with the scope to wrapping and mapping NLog to native .dotnet Core Logger (Microsoft.Extensions.Logging.ILogger) and then…
Dallas
  • 494
  • 3
  • 14
3
votes
2 answers

Where do I keep logic for file upload and calculations in onion architecture?

So.. I was working lately with onion architecture and also been reading quite a lot about it, the only thing that most of blog posts/guide/etc. did not explained is, where do I keep logic like upload of image or some calculations? Right now I got…
bunakawaka
  • 535
  • 6
  • 14
3
votes
1 answer

Onion Architecture : Can UI depend on Domain

I am making an ASP.NET MVC website with an Onion architecture. I have implemented a repository pattern and am now creating a Controller method in my project. This is my architecture: Domain : Entities / Domain Interfaces Repository : Generic…
Flexabust Bergson
  • 732
  • 14
  • 34
3
votes
2 answers

Entity Framework and Repository Pattern conceptual difficulties

I am making an intranet website using ASP.NET MVC and SQL Server 2012. I am making a repository and architecturing with Onion Architecture. My problem is that the company in which I am working, already has several Server DBs in which the tables have…
3
votes
0 answers

Can a asp.net mvc controller access multiple application services from the application services layer?

This is an architecture level question. At my work place the controllers are tied to having just one application service to call the application level code. However from my learning of the onion architecture and asp.net mvc, it seems probable to me…
3
votes
2 answers

How can MVC coexist with the Onion architecture?

I've seen people suggesting the implementation of MVC together with the Onion Archutecture. But how can the two coexist? Aren't they two distinct architectures? For example, where is the Controller in the Onion design? I understand the combination…
3
votes
2 answers

Onion Architectures, persistence and notifications

I am studying Onion Architectures and I have a point. Onion Architectures aim at isolating the Domain from technological artifacts. Therefore, the guideline is to let the Data Access Layer (DAL) reference the Domain Layer (BL). This way, I should be…
3
votes
1 answer

Inject Service in Startup Owin

I have an new application that implement onion architecture now i want to inject a service in startup class of owin. The ioc process is launched before hitting the startup class beacuse it's in a bootstrapper project that run first using…
moyomeh
  • 155
  • 3
  • 14
3
votes
1 answer

Interactor or Gateway - Uncle Bob's Clean Architecture

Considering Uncle Bob's Clean Architecture (or Onion Architecture) Let's say that as a signed in User in my app, I receive a deep link url "myapp://events/[event_id]" (via sms, for example). I want to join that Event when I click the link and…
Rodrigo Ruiz
  • 4,248
  • 6
  • 43
  • 75
3
votes
2 answers

Visual Studio - DDD Modules and Onion

I am developing a C# application following DDD and Onion Architecture concepts, but I cannot realize how to separate the code: I want it separated by modules -bounded contexts- (i.e. Sales; Suppliers; Clients) and I want it separated by layers…
Franco
  • 479
  • 3
  • 11