3,226 questions
-3 votes
1 answer
84 views
Should one service call another service or use the repository directly? [closed]
I'm learning Clean Architecture and I can't figure this out. Imagine this scenario: I have a ServiceA that calls its repository: public class ServiceA : IServiceA { private readonly IRepositoryA ...
1 vote
1 answer
130 views
How to create dynamic GORM query with Join avoiding SQL injection?
I'm trying to create query helpers for my repository pattern. Actually I'm dealing how to add join clauses. The only idea is to inject Sprintf statement but this behavior might cause SQL injection. ...
1 vote
0 answers
93 views
How to use database transactions in the repository pattern
I would like to know how to use the repository pattern with Prisma transactions. I am using OAuth, so when the user authenticates, I need to populate the user, account and session tables. If any of ...
0 votes
0 answers
66 views
How to prevent instantiating Repository instead UseCase
I am studying Clean Arch with Java. My project structure is like: project | |--domain | |--entity | | |--Student.java | |--repository | |--StudentRepo.java (...
0 votes
0 answers
52 views
Separating Firebase logic from business logic in Swift using Service-Repository pattern
I have this function in my TaskService: func deleteTask(task: DistributionTask) async throws -> Void { let (tasksCollection, userTasksIdsField, teamTasksIdsField) = task.isCompleted ...
0 votes
0 answers
57 views
How to properly organize (User)Service: DTO, Include and exception handling?
For context: I use Mapster and Serilog. public class UserService(IUserRepository repository, ILogger logger) { public async Task<TDto?> GetByIdAsync<TDto>(int userId, Func<...
2 votes
3 answers
221 views
Unit test with real database in repository pattern?
I have an ASP.NET Core Web API and services. To abstract EF Core's DbContext from service layer, I decided to use the repository pattern. However, the repository contains logic that cannot be unit ...
0 votes
0 answers
25 views
Is Unit of Work necessary if DbContext is registered as Scoped in Dependency Injection (DI)? [duplicate]
I am working on an ASP.NET Core application where I have multiple repositories, and I register my DbContext as Scoped in the Dependency Injection (DI) container: Since all repositories share the same ...
3 votes
0 answers
237 views
How to avoid unnecesary Idle in transaction in FastAPI - SQLAlchemy application with repository pattern?
This question is inspired by the articles https://www.gorgias.com/blog/prevent-idle-in-transaction-engineering and https://capnfabs.net/posts/sqlalchemy-connection-management/. SQLALchemy session ...
0 votes
1 answer
101 views
How to update an entity when implementing DDD using the repository and unit of work patterns with ASP.NET MVC?
My current solution is as follows - I want to know whether this is correct. Inside a HttpPost action method, I have the following code - Case type is an entity, case variable is passed as a parameter ...
0 votes
1 answer
79 views
Entity Framework Repository Pattern Dynamic Where and Or Where Clause
Using the Dynamic where here Entity Framework Core Dynamic Where Clause I am able to have a where on any column in any table, accessed by property name, using an Entity Framework typed repository ...
0 votes
0 answers
35 views
Model domain rules so that they can be subject to CRUD operations in a DDD application
I'm extending an application. The application main focus is scanning items and allow an operator to review and rate the results. A kind of quality inspection. We introduced the possibility of binding ...
0 votes
0 answers
64 views
ConnectionMultiplexer exception caused when trying to invoke webAPI endpoints -
I am facing an exception(ConnectionMultiplexer) message when trying to access a .NetCore 8 webAPI endpoint. I tried to use repositoryPattern in my project so there's a GenericRepository interface. I ...
0 votes
1 answer
103 views
How to get selected columns with repository pattern?
I want to create generic method to get few columns only. I am using entity framework with repository pattern. I tried with below public async Task<IEnumerable<TResult>> ...
0 votes
0 answers
77 views
How can i implement Repository designing pattern for mern project
How can I implement the repository design pattern in a MERN stack project? Also, how should I configure the database ,logic's to follow the repository pattern? what is the abstraction layer in ...