Questions tagged [repository]

For questions about the implementation of the repository design pattern.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 views

Should a repository class that performs an insert receive a domain entity or array? [closed]

I'm wondering if it's a good idea for my Repository class to be aware of the domain entity that represents the data it's about to insert Example of a Repository class that knows about a Domain Entity <...
2
votes
0answers
43 views

A UserService method that calls the UserRepository a few times

I'm trying to implement some domain driven design architecture, such as a repository to talk to the database, and a service that talks to the repository. I have an action where I want to see if a User ...
4
votes
0answers
57 views

Is there a better way to unit test a repository for a large aggregate root?

In our project we use domain-driven design and our customer aggregate root is large. The unit tests for the aggregate root itself are simple (~50 or so tests), but I am struggling with the repository ...
3
votes
1answer
129 views

Is it okay to use multiple repositories from inside a single service implementation in Spring?

I currently have two entities, Adress and Company. They both have DTOs to perform CRUD ...
3
votes
1answer
1k views

Resository Pattern and Unit of Work with ADO.net

I am trying to implement the Repository Pattern with a Unit of work but I don't know if I am on the right direction. This is my Model: ...
1
vote
1answer
182 views

Laravel 5.8: prevent duplicated code

Sometimes we have this code blocks that is repeated in the same controller again and again, I reviewed the Repository Pattern but I didn't understand how to deal with some kind of these duplication. ...
4
votes
3answers
101 views

Method that fetches rows from database and maps it to a Model class with SqlDataReader

So, I have a project that has a lot of methods that look alike. In the below method as you can see it just fetches a bunch of rows from database and maps it to a model class. In this case ...
3
votes
1answer
83 views

Refactoring code to implement clean code using repositories

I've been refactoring code today, try to implement a clean code setup using repositories. Is this on track? Can any improvements be made? ...
2
votes
0answers
55 views

Unit testing the code that is written using repository pattern

I have implemented my business logic using the repository pattern. I have an Approve method in my controller. I am calling the service method ...
10
votes
4answers
17k views

Disposing the Context in the Repository pattern

I have a question about the Repository pattern: ...
1
vote
1answer
63 views

Simple todo list VanillaJS - repository pattern

I'm new in JavaScript, so I was looking for some reviews and advice for better code quality. ...
2
votes
0answers
58 views

Swift MVVM: Repositories - loading entities and dependency injection

I create a lexikon and a navigation for ZOO. I use MVVM architecture supported by ReactiveSwift. I have a few questions about my practises and whether I could write my repositories better and more ...
1
vote
0answers
233 views

C# Generic Repository and Unit of Work Implementation for Northwind [closed]

I have created 3 projects to implement layered architecture design mainly the - Presentation Layer (Web) - Domain Model Layer - Infrastructure Layer For simplicity, I have only two domain model ...
3
votes
1answer
9k views

Generic Repository without Entity Framework

Almost all of generic repository pattern tutorials were making use of EF, so I haven't got much sources to compare my code with. Here is what I have done. Could you please suggest me to fix my wrongs ...
1
vote
1answer
48 views

Laravel function to add a supplier, and associated addresses and contacts

I have a function addSupplier() that adds a supplier. Each supplier has multiple addresses and each address has multiple contacts. ...
-2
votes
2answers
42 views

Initialize global repository or in forms? [closed]

Until now we have always initialized the repositories, that containing MySql functions, at the beginning of each Form Something like that Form example code: <...
4
votes
1answer
159 views

User controller for a .net core WebAPI dating app

I have this user controller that follows the repository pattern. It works perfect, but is it easy to understand? Is this good quality work? ...
4
votes
3answers
682 views

Pass IEnumerable<T> as an argument of method and repository pattern

I've seen tutorials of Unit Testing and I've never seen that IEnumerable<T> used as an argument of method. All authors use ...
-2
votes
1answer
232 views

Repository Pattern and SOLID principles [closed]

I have written the following Repository in C#, using NetCore 2.2 and EF Core. I was thinking how to write properly the Search method according to the SOLID principles. This code gives a null ...
2
votes
0answers
792 views

Repository + Unit Of Work Pattern in WebAPI

I am refactoring my existing product's webapi part of the solution. Current Repo pattern does not allow me to add custom functions to a specific repository. In result, most of the functions directly ...
1
vote
0answers
2k views

Transaction integrity in asp.net core with entity framework and generic repository

I am not very experienced in Entity Framework, I previously used ADO.Net and Dapper for data persistence. For now, I only read Microsoft docs and watched a few video tutorials. I tried to stick to ...
3
votes
0answers
1k views

Generic Unit of Work implementation

I am implementing the unit of work pattern to be used in the logic layer of my application. The goal is to abstract away the tasks of managing transactions / connections. My implementation relies ...
1
vote
1answer
45 views

Showing data for a chat with another user

I have a get route to show the data for a chat with another user. If an existing chat exists I want to return that, otherwise create a new chat and return it. ...
2
votes
1answer
107 views

Repository of trainers

This is my first asp.net core web api and i did followed the Repository pattern but i don't know whether this approach is good practice. ...
8
votes
1answer
12k views

MVC 5 & EF 6 - Repository & Unit of Work Pattern

I have been looking through Code Review on the subject of Unit of Work and Repository patterns and realised that my implementation appears to provide very similar functionality but in reverse class ...
1
vote
0answers
211 views

E-commerce site for posting advertisements

I am developing an e-commerce website in ASP.NET MVC. Users can post advertisements of different types on the site. I am using inheritance to define my Ad types, and this review is mainly about ...
3
votes
0answers
2k views

Structure and Implementation of Generic Repository and Unit of Work patterns with Dapper and SqlTransactions

I am attempting to update some legacy code that I work with, but my knowledge of data access is limited to a basic use of Entity Framework and simple Dapper. After some research, I have a loose ...
3
votes
1answer
55 views

Registering an event participant, using Entity Framework and several associated models

I have a method that is responsible for receiving an object and perform the information saved with Entity Framwork, using the Repository pattern. The issue is that this object is, basically, a DTO. ...
1
vote
1answer
502 views
5
votes
2answers
4k views

Repository pattern along with 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 ...
18
votes
0answers
1k views

Repository pattern in Rust

I'm looking to add a thin layer of abstraction for database interaction in my application. I'm not really looking for a full blown ORM or advanced query builder. I am familiar with Diesel, but its ...
3
votes
0answers
1k views
1
vote
2answers
159 views

Check repository for a nested entity

I have a Product entity and a ProductCategory entity. Given the Product entity, my ...
1
vote
1answer
985 views

ASP.NET Identity 2.0 UserManager alongside with UnitOfWork and Service-Locator anti-pattern

I was wondering whether it is a good aproach to have Identity 2.0 UserManager next to UnitOfWork pattern? I am using ...
2
votes
0answers
1k views

Entity Framework with two databases (with UoW, Repository and Service Layer)

I have two databases: one for a warehouse, second for the office (The db design is out of the scope of this question). There are MANY cross-database funtions. One of those functions is ...
0
votes
1answer
56 views

Repository layer for MongoDB

I've implemented a quick and dirty repository to save and insert users to a MongoDB. As you can see, it just inserts one and finds one. Not a rocket. The thing is I don't really know what are the ...
0
votes
1answer
866 views

Entity Framework MVC updating db using a repository method [closed]

I have inherited this code from a legacy project, and it is throwing a New transaction is not allowed because there are other threads running in the session. error. Now I know the problem here is ...
1
vote
1answer
789 views

Instantiate repository classes dynamically

I'm curious about the best way to instantiate my repositories. Currently they're in the main controllers constructor method. I was thinking making separate controllers for inbounds, outbounds, ...
5
votes
3answers
4k views

Generic repository pattern

Please have a through look my custom implementation of generic repository pattern and suggest anything I may be lacking. I am using a generic interface with 6 methods I'll be using a repository class ...
7
votes
2answers
20k views

C# - Entity Framework + Repository pattern + Unit of work pattern

After hours spent on reading various articles about correct way to implement Repository patter & UoW patters I finally think that I have managed to create (hopefully good) implementation. The ...
1
vote
1answer
9k views
3
votes
1answer
298 views

Reduce boilerplate with RepositoryPattern

I'm refactoring a WPF application that uses Repository pattern to access the web services, I've got a tons of repository wrote as ...
4
votes
1answer
778 views

Event sourcing with Python

I've been studying the event sourcing pattern and trying to come up with a set of classes or minimal library I can share across projects. Below you can find the implementation of this main parts of ...
2
votes
1answer
2k views

Generic repository with UoW and simple injector

I'm implementing a generic repository + UoW pattern with EF6 and simple injector. I feel there is room for improvements. Please let me know if I left out some relevant code, I tried to keep it breif. ...
3
votes
1answer
70 views

Returning generic types from Repository

Is it bad design if I create repostory with methods that returns generic types. For example in AccountsRepository if I have: ...
3
votes
3answers
527 views

Generic data interface

I currently have the following working code. I am looking for some suggestion with best practices and perhaps a better way to accomplish my goal. Goal: - in short - Have a generic data interface as ...
3
votes
0answers
399 views

Generic repository accessor in a unit of work

I'm giving the repository + UoW patterns my first shot on the server side, so bear with me. Also, it's worth mentioning that I haven't used an IoC container on the server side before either, so I'll ...
2
votes
0answers
411 views

Unit of Work pattern for NHibernate

I have the following code implemented in C# for NHibernate: ...
1
vote
1answer
382 views

First attempt at Data Driven Design with MVC, to manage a user list

After what I've felt is a sufficient amount of research, I have made my first attempt at a domain driven design MVC project. I would love for you guys to tear it apart and give me pointers to make it ...
3
votes
0answers
2k views

Repository pattern with Specification queries

I'm working on an Android (Java) project which utilizes different analytic metrics (sum of x group by date, sum of x group by id, etc) and I am projecting the data sets into different charts using ...