Questions tagged [repository-pattern]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
161 views

Update Entity for Repository Pattern and UOW Pattern C#

In one mock solution, I have created 3 mock projects to implement layered architecture design mainly the - Presentation Layer (Web) - Domain Model Layer - Infrastructure Layer. I haven't yet to add ...
2
votes
3answers
159 views

DataAccess Layer coupling with Domain Layer

We have an issue with how the implementation of the Data Access layer (EF6 Includes more specifically), influences the behavior of our Domain layer. A theoretical example to illustrate: Application ...
1
vote
1answer
165 views

Is it acceptable to invoke business logic inside the repository layer?

I'm learning DDD and I'm wondering if it's ok to invoke domain model logic from inside the repository layer? I don't mean that the business logic exists as part of the repository, merely that the ...
0
votes
1answer
42 views

How to access parent relationship in repository pattern

I have two models Permission and Role, now in roles/create, I need to show all the available permissions to allow admin to select the permission and create a role, now should I import both ...
4
votes
1answer
5k views

Unit Of Work with multiple database context

I have created an application (net core 2 & ef core) with Unit Of Work and Generic repository pattern. I used to have one database context but due to some business logic I had to create a second ...
0
votes
4answers
261 views

Which layer do DDD Repositories belong to?

In his DDD book Evans promotes the idea of layered architecture, and in particular that the business logic should be confined to domain layer and separated from UI/persistence/other concerns. He also ...
3
votes
2answers
434 views

How to implement Repository that supports ORM's validation?

Domain Driven Design(DDD) has an abstract repository pattern to handle saving and fetching/finding entities in storage (db, external service, doesn't matter). My question is if Repository Pattern has ...
0
votes
1answer
42 views

Questions about Direct access to data source from Services

Background: I'm trying to separate my concerns in the application architecture the best possible way. In a nutshell: The requests are parsed and go to an Action Action decides which service(s) to ...
2
votes
3answers
995 views

Is it a good idea to share repositories across microservices in Spring Boot Application?

We are migrating a desktop application into web based Spring Boot micro services application with a client imposed mandate of using their existing MySQL database, so all micro services share a common ...
2
votes
1answer
78 views

Mercurial topology in three stage implementation

A few years ago, now, we had a chap working with us who introduced the following topology for Mercurial... The main repository server obviously holds the primary repositories, as you'd expect, but ...
1
vote
1answer
265 views

Domain Driven Design - updating part of aggregate

I'm playing around with DDD in a node.js project and struggling with updates to child entities from the aggregate root. For the sake of example, let's say I have two domain objects where Event is my ...
2
votes
2answers
263 views

Dependency inversion vs repository pattern (app layer dependency on ORM)

Let's say we have an application layer with some command handler and we use an Entity Framework database context/ORM context in that handler. I would invert dependencies from the Entity Framework/...
0
votes
1answer
122 views

Does a 'leaky' repository implementation defeat the point of a repository?

I've seen some tutorials and examples of implementing a repository pattern, and I don't quite understand something. My impression was that the whole point of a repository pattern was to hide the ...
1
vote
4answers
199 views

Object Oriented Design: Repositories and Inheritance

I have an OO design concern. Let's say my models as following: class Account {} class LocalAccount extends Account {} class SocialAccount extends Account {} These Account entities are persisted and ...
1
vote
2answers
453 views

How to get ORM (Ef Core) Entities follow a DDD style . Which is the best approach?

I am considering mutliple options to face a problem. I want to develop software following DDD style. The problem arise when I have to define my entities and I am working with Entity Framework Core, ...
6
votes
2answers
2k views

Should Entity Framework 6 not be used with repository pattern?

So I am asking this after reading the following: Why shouldn't I use the repository pattern with Entity Framework?. It seems there is a large split of people who say yay and those that say nay. ...
0
votes
1answer
158 views

Circuit Breaker + Retry - Repository or Application Layer

I currently have a Web App using ASP.NET Core 2.2, Domain Driven Design, Clean Architecture, and CQRS. I'm using MongoDB as persistence. I have developed a Repository pattern to abstract the MongoDB ...
-1
votes
1answer
29 views

where to put business constraints

We have a 3-tier architecture: Web, Business, Models using the MVC pattern. Models are Code-First using EF6. Currently we access the dbContext directly in our Controllers to query and save changes. We ...
4
votes
3answers
162 views

Is a repository return a graph of entities violating SRP?

I'm working in this scenario Post entity has many Image entities. I also have repository to both entities: PostRepository ImageRepository Since this entities are tightly related, when I get a Post ...
7
votes
1answer
4k views

How to structure microservices in your repository

I am assigned to a project where we have about 20 micro-services. Each of them is in a separate repository without any references to any other, apart from one Nuget package where we maintain some ...
-1
votes
2answers
42 views

Logic to create/update values while maintaining their uniqueness (in a multi-threaded environment)

Assume I have a dumb repository which stores numbers (for sake of this example). It is dumb because it may only create new record, update specified record and list all the existing records - no other ...
0
votes
2answers
1k views

CQRS using queries or read services only?

Discussing about a CQRS implementation with my team we don’t agree on a point concerning the Query side. On the Commad side we have actual command clases; a CommandDispatcher that schedules commands, ...
0
votes
2answers
366 views

Is it ok for Repository Pattern to contain unusual method names?

For example I need to find a user which its status is 0 and its name is John. So beside usual methods for a Repository pattern (e.g. find, create), I decide to create a method in UsersRepository ...
1
vote
0answers
75 views

Should a UnitOfWork contain every Repository?

I'm trying to get the Repository/UnitOfWork pattern figured out. We're working on a project with EntityFramework and our DBContext contains 200+ tables. Right now our approach is to inject whatever ...
1
vote
1answer
252 views

How does a Repository delete removed Value Objects from the DB without ORM?

Let's say an Entity is composed of multiple ValueObjects. For instance, a wanderer might leave a few footprints behind. Imagine I load Wanderer from a repository and delete all footsteps north of the ...
4
votes
1answer
143 views

Repository Pattern whith complementary objects (agregates)

Refactoring an old API into a new one, because of several tools using it (admin and some mainteinance scripts) and compatibility with older versions reasons the database structure must remain the same....
1
vote
1answer
914 views

Repository pattern, call another API that updates a SOR's from service or repository class?

We are working on API's that call other API's that will inevitably retrieves/update a system of record like an SQL, MySQL or other database. Sometimes we'll have 3/4 layers of API's before the SOR is ...
3
votes
1answer
157 views

Repository that performs API calls internally - DDD

Please note: although my question relates to DDD, I am also interested in this from an architectural and OO design perspective. This question may also be a simple case of CQRS and/or interface ...
9
votes
2answers
3k views

Repository Pattern vs DAL Object Creation

As far as I've learned, the IRepository should contain CRUD. Then we inherit this IRepository in our other Interfaces like IProductand implement IProductconcrete class ProductRepository, with methods ...
4
votes
1answer
2k views

Access multiple entities in repository - clean architecture

I have a API call that returns a list of Payments, each Payment contains a User. I need to call it, save the results in the database, fetch all the payments and users and return them all to the ...
1
vote
0answers
47 views

Correct method for handling edit/update scenario in repository pattern

I have a repository pattern employed in my .NET Core 2.1 project. While implementing the edit/update scenario, I have a doubt. My domain: public class Component { public int Id { get; set; } ...
1
vote
2answers
1k views

Unit of work + repository pattern + dependency injection

I am in the process of refactoring and improving a codebase. One of the major missing features is transactional safety and certain errors arising from each repository having its own DbContext. The ...
0
votes
1answer
71 views

Domain model and feature Crypter

In my project I must implement a feature for encrypting some information when it is written into the database, and decrypt the information when it is reloaded. Should this concept be implemented in ...
0
votes
1answer
47 views

Function for processing files: Business Layer, Service Layer, or anything else?

I read that Repositories should not refer to other repositories. I have a method ProcessFile that refers to multiple repositories, it parses a file, and inserts into many table models in different ...
4
votes
2answers
410 views

Handling disposables with dependency injection

I'm struggling to implement disposable objects via dependency injection, as the dependencies are injected in the constructor (and live as long as their containing object does), whereas I want the ...
4
votes
1answer
680 views

Should unit of work create repository?

Our "unit of work" class has a method which takes a class type and creates a repository: public IRepository<TEntity> GetRepository<TEntity>() where TEntity : class { ...
1
vote
0answers
2k views

Proper implementation of Repository Pattern with MVVM in WPF

I am currently refactoring a WPF application that is built on the principles of the Repository Pattern. It uses Entity Framework as its ORM, and is Database First. Each of those entities is wrapped by ...
0
votes
1answer
227 views

Swapping Entities or ORM in repository pattern

Lets say i am following Repository pattern in my application and i have class UserEntity { private $model; public function __construct() { $this->model = new UserModel(); } }...
3
votes
3answers
351 views

How can database-specific functionality, such as increment/decrement features, be used in DDD?

I have an entity that has a dollar balance property. Whenever an event occurs that causes the balance to change, such as a debit, within the same transaction the balance should be decremented by the ...
-1
votes
1answer
75 views

What is the best way to use table and column names in repository pattern

My application follows repository pattern in the data access layer. However, I see, in repositories' data retrieval methods, column names and table name are hard-coded strings, which I think is not ...
0
votes
1answer
172 views

Is invoking one repository from another a code smell?

I recently came accross an old webapp project which is using a repository layer between domain and persistance layer. However, the repository layer has been used weirdly. One example is the blog ...
1
vote
2answers
509 views

Where to place POCOs validation - N-layers architecture

I am developing an n-layer app. One of the layer is the BusinessLayer and consumes a set of POCOs defined in the CoreLayer. Also I have a PresentationLayer (WinForms) CoreLayer POCOs (classes with ...
-3
votes
1answer
213 views

Using pattern “Repository” for table relations

Have read about "Repository pattern", before it, I have used pattern DAO (data-acess-object). How should I implement table relations with this pattern? Should I create entity for links between tables?...
1
vote
2answers
148 views

How to implement Domain Model with Repository without leaking responsibility?

Imagine, we have test modules with large number of questions and we can create tests which will contain exactly 30 questions. public class Module { public long Id { get; set; } public List&...
0
votes
1answer
311 views

Hexagonal Architecture and database concurrency

I have been reading Alistair Cockburn's article on Hexagonal Architecture. One question that occurs to me, is how to handle situations where there are database concurrency issues. An obvious example ...
0
votes
1answer
486 views

More appropriate to validate a dependency filter parameter by mock+stub or by expression compile?

My lead is enforcing TDD on our project. He says he's following Uncle Bob (Robert Martin) and SOLID principles. One of the rules he's reinforcing is what I call "the single cog rule"--there should be ...
3
votes
3answers
5k views

Data Entities, Domain entities and the repositories

I'm trying to get my head around DDD but I'm stuck. This is how I setup my project: Data Access Layer -Entity models that map to the db -Db connection stuff -Repositories implementations Domain ...
6
votes
1answer
12k views

Generic repository pattern +EF and unit of work

I'm new to this Repository pattern and have seen lot of repository pattern + UoW implementations all over the internet and I'm not able to reach to a conclusion as to which of them is correct . After ...
1
vote
1answer
3k views

CQRS with Repository pattern and Inversion of Control (with DI)

I assigned a POC project to someone where I asked to implement both Command Query Responsibility Segregation, Inversion of Control (with Dependency Injection) and Repository pattern. “Someone” gave ...
1
vote
1answer
203 views

Is it bad practise to create instances from a SQL-query?

I'm researching ways to create a OO-model/repository-layer using PHP's PDO. My idea was to create model classes that represent a domain object and a repository class for each model that has the ...