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
0
votes
0 answers

Your startup project '' doesn't reference Microsoft.EntityFrameworkCore.Design

I have an web application that is designed based on Onion Architecture. The ORM I used is "Microsoft.EntityFrameworkCore" Version="5.0.10" in Infrastructure.EFCore layer .My startup project is a Razor Pages application. When I use the command…
0
votes
1 answer

Can't get website meta description over tor network using PHP

Dear friends I'm trying make a interesting project that we can enter a tor .onion address and find the website title and meta description related to it. So here is my code,
0
votes
1 answer

Onion Architecture Design with multiple applications

-Solution --Domain --Infrastructure --Service --WebAPIApplication --ConsoleAplication I am currently working on a project to create a WebAPI application with Onion Architecture. The above image is my current solution structure. I have no issue…
andy
  • 11
  • 3
0
votes
1 answer

Aggregate data from two different database contexts

I have two database contexts. First: ASP.NET identity context. public class IdentityContext : IdentityDbContext { public IdentityContext(DbContextOptions options) : base(options) { } } Identity user. public…
Hedgehog
  • 89
  • 9
0
votes
0 answers

How can I get logged in user's claim on Persistence layer (Onion Architecture)

I am trying to access logged in user id in Persistence layer. I am using Claim and want to capture centralize created by and created on, logic below is my code kindly suggest me best approach public class DBContext : DbContext { public override…
0
votes
1 answer

Advice on filtering data and code reuse with Onion Architecture

Here are my questions and then I'll give you the background for them: I would prefer to use Method 2 as my application design, so is there a way to provide filtering like Method 1 without introducing references to non-business code and without…
0
votes
1 answer

How to avoid delivering unnecessary inner layer code with an installable client app?

In Onion Architecture, business logic lives in an inner layer. So it can be referenced by outer layers like the UI, in my case a Web App. Now I want to create a small companion app that users can install on their phones or computers. Naturally, I'll…
Sandro
  • 2,998
  • 2
  • 25
  • 51
0
votes
3 answers

EF Core 5.0 How to manage multiple entity class with one generic repository

First question here, I hope I'm doing it right. I'm using Entity Framework Core 5.0 (Code First) with an onion architecture (data/repo/service/mvc) and so I have a service for each table (almost). It's work well but now I need to manage (get,…
0
votes
1 answer

Calling repository from domain with interface Hexagonal Architecture

I need to know if an entity (User) matches given some criteria. I have defined the criterions in the domain and they implements an interface: match(User)bool Now the problem is one criterion needs the data of the other entity (Company), and User…
0
votes
1 answer

How do i avoid, that the domain layer knows the adapters?

Let's say i have a usecase (business logic), an adapter (database) and a domain object. I need to call the database from my domain logic, but the question is how. The way a do it right now is by giving the domain the adapter: (1. variant) function…
David
  • 2,926
  • 1
  • 27
  • 61
0
votes
1 answer

Onion Architecture - DTOs in interfaces

I'm new to Onion Architecture and am trying to apply it in an ASP.NET project. I'm currently implementing ASP.NET Identity and want to use its UserManager class to store users. From what I understood from Onion Architecture is that I should create…
0
votes
3 answers

How can I access the Database field of a database context interface?

I'm using .NET Core 3.1. I have the following problem: I want to do a transaction in the Application layer. There I have a DbContext interface because I don't want to have access to the Infrastructure layer where I have the DbContext class. In other…
0
votes
1 answer

Using AutoMapper inside Onion Architecture

We are implementing an aspnetcore web api application using the onion architecture. I have the following rings: Domain Application Infrastructure Dependency Resolver So far we have managed to keep all third party implementations in the…
User20909
  • 105
  • 10
0
votes
1 answer

Avoid cross project dependencies in onion architecture

I have an onion architecture that follows this diagram: In which each project is connected to the "center" through interfaces. Now, I am in the situation in which the Payment Gateway needs to store some data. It would be amazing if it had access to…
0
votes
1 answer

How To: Active State During Server Action w/o JavaScript

On a page in the webapp I work on, users can select a file to upload and compose a message. When the user clicks "Send," I want the UI to reflect an active-state for the duration of the upload (not just as a pseudo-class for the clicking of the…