Questions tagged [repository]

For questions about the implementation of the repository design pattern.

Filter by
Sorted by
Tagged with
3 votes
2 answers
653 views

Banking System in C++ [V2]

this is the second version of my BankingSystem in C++ for the first one go here: Banking System console app in C++ I did quite a lot of changes since the last version mainly spliting the User class ...
Ellie's user avatar
  • 347
4 votes
4 answers
3k views

Banking System console app in C++

I built a banking system in C++ (still a lot of features to do but (I decided to post it here to see what can I change so I wont make those mistakes in the future). User header and c++ files Header <...
Ellie's user avatar
  • 347
4 votes
1 answer
365 views

Unit of Work & Repository Pattern - Injecting UoW into Repository Base

Description I am implementing the Unit of Work & Repository Pattern with Dapper as my ORM and PostgreSQL as the relational database. I have seen examples of UoW where: The UoW class creates an ...
zwoolli's user avatar
  • 41
2 votes
1 answer
141 views

Command handlers in node.js

Description This javascript code uses tmi.js to listen for chat messages in a Twitch chat and perform certain actions depending on their content. In the sample code ...
Patrick Christie's user avatar
1 vote
0 answers
40 views

Frontend to handle course planning and administration [closed]

I read up on and dived into the Repository pattern for a project I am working on. I have understood that the repository abstracts the actual access to any form of storage for my data model. What I was ...
lhiapgpeonk's user avatar
1 vote
0 answers
126 views

.NET Repository Pattern

I'm currently in the process of defining some framework, one of the first things that I thought I could start with was defining some repository pattern/layer. I generally wanted some input on it, ...
JO3-W3B-D3V's user avatar
0 votes
1 answer
444 views

Generic Base Repository implementation with Unit of Work in C#

I have seen a lot of Repository pattern implementations with Unit of Work. The simplest way of implementing this I came across is using hard-coded repos (such as this one), while the way recommended ...
oneManArmin's user avatar
2 votes
1 answer
142 views

Is it good way to user dao when assembling dto to entity or not?

I have User entity that has relationship to other entities(Order,Profile) When I assemble entity from dto and back I need assemble order and profile entity too. User entity: ...
DozezQuest's user avatar
1 vote
1 answer
118 views

Is My Controller too Coupling?

To put it in context, I had the assignment to do for a job interview in Node.JS, which basically making CRUD with products (and it have certain conditions). The assignment was well-understandable, and ...
Eloic08's user avatar
  • 19
0 votes
0 answers
2k views

Dapper UOW with Multiple Databases

Scenarios / Requirements: I am working on to convert the existing WebAPI Data Layer to Dapper from EF. The following are the ...
Akhil's user avatar
  • 121
4 votes
2 answers
8k views

Should i throw exceptions in the service layer or repository, and catch it on the controller? [closed]

I read some answers here on stack exchange, but none really "hits the nail on the head" about where to throw exceptions, where I shouldn't and where to catch them. the idea that an exception ...
Thiago Dias's user avatar
2 votes
1 answer
1k views

Is repository pattern violated while using IQueryable outside of it?

I am writting an API backend application using .NET Core and Visual Studio. Here is the solution structure: [ProjectName] - Solution ...
user238115's user avatar
2 votes
1 answer
105 views

Reducing Inventory Quantity When Order Is Being Processed

I've got a method which removes quantity from inventory when an order is completed. If there is not enough inventory quantity available, the order completion fails and the sql transaction is rolled ...
GisMofx's user avatar
  • 143
2 votes
0 answers
59 views

Monitor room repository for livedata changes and update views

I have built a quiz app. It is my first project so the purpose is to learn app development at this stage. There are two key things which I am wondering how to do better (the app is fully functional). ...
UnknownError's user avatar
4 votes
2 answers
3k views

Repository pattern with Unit of work using ADO.NET in C# to authenticate user from database

So I am using the latest version of Dapper and it works great for mapping my POCO classes but there are some scenarios where I need to return a DataSet instead of ...
Rahul Sharma's user avatar
6 votes
1 answer
138 views

Expiring key/value repository. Java

The following code is in-memory repository that stores key/value pairs. It will be used on our server to keep information about active clients. Clients send keepalive messages to indicate that them ...
bw_dev's user avatar
  • 257
3 votes
1 answer
2k views

Handle database validation (exists, unique constraint, etc) [closed]

Let's assume you are writing a REST Api with a common structure like Controller > Service > Repository > Database. In the database there's a table with a column with a unique constraint: <...
chenny's user avatar
  • 183
3 votes
0 answers
589 views

Simple Sqlite-driven WinForms app in C# 7.0 - database interaction code

Description This is a simple "demo" app designed to help gain familiarity with interacting with an Sqlite database from C#, particularly storing images as blobs. The database has a single ...
Al2110's user avatar
  • 404
2 votes
0 answers
78 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 ...
Miguel Stevens's user avatar
4 votes
0 answers
108 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 ...
David Anderson's user avatar
3 votes
1 answer
4k 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 ...
Alexiz Hernandez's user avatar
1 vote
1 answer
770 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. ...
Yousef Altaf's user avatar
4 votes
3 answers
2k 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 ...
SamuraiJack's user avatar
3 votes
1 answer
113 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? ...
MM1010's user avatar
  • 133
2 votes
0 answers
72 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 ...
Tom's user avatar
  • 217
1 vote
1 answer
159 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. ...
Adam Borowski's user avatar
2 votes
0 answers
140 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 ...
SupDaniel1994's user avatar
-2 votes
2 answers
64 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: <...
Lorenzo Belfanti's user avatar
4 votes
1 answer
204 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? ...
Andre's user avatar
  • 41
4 votes
3 answers
3k 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 ...
StepUp's user avatar
  • 553
-2 votes
1 answer
333 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 ...
MarcosF8's user avatar
  • 101
2 votes
0 answers
1k 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 ...
Akhil's user avatar
  • 121
4 votes
0 answers
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 ...
Tagor's user avatar
  • 141
1 vote
1 answer
69 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. ...
Ahmed essam's user avatar
1 vote
1 answer
50 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. ...
Cory Baumer's user avatar
2 votes
1 answer
129 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. ...
Lakshan's user avatar
  • 133
1 vote
0 answers
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 ...
ibubi's user avatar
  • 131
3 votes
0 answers
3k 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 ...
neldridg's user avatar
3 votes
1 answer
60 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. ...
Adolfo F. Ibarra Landeo's user avatar
1 vote
1 answer
656 views

Cached Repository that can refresh all or a subset of the data

IReadOnlyCachedRepository<T> ...
Shelby115's user avatar
  • 1,961
3 votes
0 answers
2k views

My implementation of repository pattern in Laravel 5.6

...
Latheesan's user avatar
  • 293
1 vote
1 answer
1k 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 ...
Marek's user avatar
  • 123
5 votes
2 answers
5k 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 ...
Codebadger's user avatar
2 votes
0 answers
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 ...
Marshall's user avatar
0 votes
1 answer
82 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 ...
Javier García Manzano's user avatar
0 votes
1 answer
909 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 ...
kolin's user avatar
  • 129
4 votes
1 answer
15k 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 ...
ibubi's user avatar
  • 131
7 votes
2 answers
22k 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 ...
hyperN's user avatar
  • 231
3 votes
1 answer
334 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 ...
advapi's user avatar
  • 165
3 votes
1 answer
229 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: ...
grizabela's user avatar