Questions tagged [repository-pattern]

The repository pattern provides a way to provide isolation between the data access layer of your application with the business layer. When using this tag on implementation heavy questions - tag the code language the implementation is written in.

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

What is a good way to use modules that have related entities?

I've been coding for some time and always looking for improvement! That's why I am learning about how to structure my modules in code well. And now I am facing a dilema based on my experience with ...
dalvi's user avatar
  • 37
-1 votes
1 answer
77 views

How to build a Symfony Repository from scratch?

I'd like to build a Symfony application without a database. But I do like the Repository/Entity pattern that is (usually) provided by doctrine. So I'd like to build my own repository service and ...
commonpike's user avatar
  • 10.6k
-2 votes
1 answer
48 views

Encapsulating the query logic in EF Core

Recently, I came across a blog post regarding the encapsulation of queries in EF Core. This approach is somewhat different from the repository pattern which is much more familiar to me. In repository ...
Yashoja Lakmith's user avatar
0 votes
1 answer
49 views

Register image with others data in api crud

I am workin in a side project and this project is a CRUD API in ASP.NET Core, until now that is the model of my datas public class Book { public int Id { get; set; } public string Name { ...
Kayron Bragança's user avatar
1 vote
1 answer
28 views

How to decide where to store a method for accessing a database, if it interacts with two or more tables?

I am a beginner on a coding bootcamp and I'm learning to make a CRUD app from scratch using Flask, Python, PostgresQL and psycopg. I'm trying to create the backend for a Twitter clone that has Users, ...
Claire's user avatar
  • 11
0 votes
0 answers
22 views

Android SharedViewModels vs Clean Architecture repositories

Let's say I have a flow of screens A, B, C, D where user constructs along the screens some data to perform a final operation with them on D, but be able to go back to previous screens to edit some of ...
htafoya's user avatar
  • 18.5k
0 votes
2 answers
131 views

Repository Generic repository with Unit of Work for C# .net core with MongoDB

I am new to .NET core and designing Asp.net core application layered architecture. We are using generic Repository with Unit of Work repository pattern. Completed the generic repository method, need ...
ramakrishnan r's user avatar
0 votes
1 answer
58 views

Laravel: How to retrieve a named route, but assign parameters later

I like to simplify my controllers as much as possible. When dealing with APIs, I sometimes use a service class (repository?) method that expects some input as well as a RedirectResponse like so: use ...
Phil Tune's user avatar
  • 3,174
0 votes
1 answer
66 views

Android: Model mapping in repository pattern

I want to fetch news from remote and map network response to entity class to store in room database in repository layer. i am using separate data class for both remote and database Here are the data ...
Techchai Mobile's user avatar
0 votes
2 answers
52 views

Transformation logic for import entities from an external repository to a domain entity

I have an entity in my domain called 'Service.' For simplicity, let's assume it has just two value objects: ServiceId (uuid) ClientId (uuid) I can access this entity through its own repository ('...
David's user avatar
  • 33
0 votes
0 answers
37 views

How do I write a test for the failing request to an API made in the viewModelScope in Android?

I have a view model which creates a mutable state using a sealed interface. My question is How do I write a test when the repository returns a Result.failure(e) in order to assert that the marsUiState ...
Camilo Ruiz's user avatar
0 votes
1 answer
85 views

Python typing: concrete class that implements protocol with method that takes another protocol as argument

I'm trying to get the typing correct for the following example: from __future__ import annotations from dataclasses import dataclass from typing_extensions import Protocol @dataclass(frozen=True) ...
rokkuran's user avatar
1 vote
1 answer
214 views

Where does cache lie in clean architecture

For one of my microservices projects, I decided to structure the code as controllers, services, and repositories. The API call routes to the controller, which then calls the service, which then calls ...
potatoxchip's user avatar
0 votes
1 answer
51 views

Repository Pattern Implementation for Blog-Post with photos application

Consider a application that allows you to create, list and view blog-posts with photos. However the application also gives a place where user can view all the photos they have added in all of their ...
Aaditi Jain's user avatar
  • 6,977
1 vote
0 answers
73 views

Service / Repository pattern for multiple integrations / backends?

I have a domain entity named Stream. Stream has the following model: export type StreamConnectorType = 'TYPE1' | 'TYPE2'; export type StreamType1Details = { // Properties relates to Type1 } export ...
ThomasTaylor's user avatar
0 votes
0 answers
14 views

xUnit and moq with Unit of work and generic repository pattern in web api c#

I'm working a .net 6 and entity framework 6. Currently working in xUnit moq , so for post method need example code I have Unit of work and Generic repositoy pattern in my web api c# project with ...
Sophia Kasinathan's user avatar
0 votes
1 answer
39 views

Where to put SnapshotListener (Firestore) in MVVM

So I've searched for a while now but didn't got a specific answer for my question. I'm implementing MVVM right now in my android studio project and I really don't know "the best practice" of ...
Sasuke's user avatar
  • 33
0 votes
1 answer
78 views

Can I call Swift URL Session from Kotlin Multiplatform?

I am working on an architecture where View is in Swift, VM in swift, however want to get the repository in Kotlin multiplatform. I understand immediate question would be why you want to separate ...
Dipesh Pokhrel's user avatar
0 votes
1 answer
169 views

When or in which case should i use RepositoryProvider in Flutter Bloc?

I was fetch data from api without RepositoryProvider, but I saw RepositoryProvider on documentation. What is difference? or Should I use for data? When I used RepositoryProvider, I couldnt change ...
Nijat Naghiyev's user avatar
0 votes
0 answers
15 views

Android room database sometimes get null Application instance, sometimes it work

I'm trying to create an instance of room database like this: @Database(entities = [NotificationEntry::class], version = 1) abstract class ApplicationDatabase : RoomDatabase() { abstract fun ...
Maifee Ul Asad's user avatar
0 votes
1 answer
37 views

Getting compile error when initializing classObject = new();

In our .NET REST-API, I have a DTO-class and a C# Controller-class. The DTO-class is as follows without any compilation errors. This DTO contains a variable for the INSPECTION and an IEnumerable/list-...
John D's user avatar
  • 551
0 votes
1 answer
76 views

Micronaut Hibernate Reactive: Issues with 'findAllBy' when using a property whose name is a part of another property's name

I'm writing a new version of a Service previously written using Spring Boot using micronaut, and currently I'm porting existing entities and I have come across this issue, seems that ...
dttz's user avatar
  • 13
0 votes
0 answers
48 views

Repository pattern in .net C#, problem with returning customized error

So it's new to me and I have a certain problem. I'm using repository pattern, so the functions in the controller call the matching functions in the service class. But the function in service checks ...
user3265447's user avatar
1 vote
2 answers
203 views

API Response handling in Clean MVVM Architecture

I've build app using Clean Architecture now I'm planning to add Network Layer validation into it. Below is the code how I have implemented this in my app. interface JokeApi { @GET("joke/Any&...
Swapnil Musale's user avatar
1 vote
1 answer
434 views

NestJS Repository gives error 'No metadata for "TaskRepository" was found.'

GitHub link to project: nestjs-task-management Error Log: [Nest] 15824 - 23/08/2023, 11:22:29 LOG [NestFactory] Starting Nest application... [Nest] 15824 - 23/08/2023, 11:22:29 LOG [...
SAIF ALI's user avatar
1 vote
1 answer
74 views

Usage of Select with Generic Repository Pattern

I created generic repository pattern for repository actions. I want to use Select for instance of repositories. My codes at below are explanatory for this situation; This is my IGenericRepository; ...
EsprnzJK's user avatar
0 votes
1 answer
93 views

Store login access token into sharedpreference in android MVVM architecture

currently i'm working with a real time api and in login api i got a access token in response. as i am following mvvm pattern i handle my datas by repositories. and i wants that the token i am getting ...
Asikur Rahman's user avatar
1 vote
1 answer
97 views

Delete child table records from database using EF Core 7

I have a solution where I am using the repository pattern along with UnitOfWork. I have a repository for aggregate root (ParentTable) which has a relation with ChildOne, ChildTwo tables. ParentTable? ...
Alisbha Khan's user avatar
2 votes
1 answer
63 views

WebApi to Service & Service to Repository pattern with dependency injection but limited references

I am refactoring an existing dotnet core application where in short we have a WebApi project Business (services) project Repositories project Datalayer project Currently, in our webapi project, all ...
Verthosa's user avatar
  • 1,670
0 votes
0 answers
48 views

How JS Repository Pattern works

At the moment I'm trying to understand how websites fetch their data. I picked one website and monitored the network traffic but I couldn't find any request, which contains the information, which are ...
Klerano's user avatar
  • 11
0 votes
1 answer
30 views

Matching arguments with Moq.ItIs<expression tree>()

I don´t know how to pass a expression tree using the Moq.ItIs<> The type of the parameter is Expression<Func<Destination, bool>> But I don´t understand why I can´t pass something ...
partymetal's user avatar
-1 votes
1 answer
48 views

EF Migrations on Generic Repository

I´m creating a generic Repository with Entity Framework. It looks like this: public abstract class EntityRepository<TEntity> : IEntityRepository<TEntity> where TEntity : Entity { ...
Jaime's user avatar
  • 131
-1 votes
1 answer
190 views

Is it necessary to implement Unit of work patterns when using time series database.(ex: influxDb)

I am working on project which uses EF for sql database and infulx data access for historic data. I have implemented unit of work patterns for the part of sql: _context.Save(); but i was not sure if ...
roxan.an's user avatar
1 vote
1 answer
79 views

Link pairs of type bounds together in Python

I am trying to create an abstract repository class so that I can reduce drastically the length of my boilerplate code. Meanwhile, to do so, I would need to link the bounds of Entity to a certain ...
lays's user avatar
  • 158
0 votes
1 answer
22 views

how to allow the service layer to manage multiple repository layers during insertion

Folks, The problem statement can be found as follows, Background: the application collect user information, which can be modeled by AggregateA, and AggregateB; AggregateA contains a collection of ...
bruinon's user avatar
  • 11
0 votes
0 answers
41 views

How to implement MongoDB transactions in a Node.js Express REST API project using the repository pattern?

I am working on a Node.js Express REST API project that follows the repository pattern for data access. I would like to implement MongoDB transactions in this project. However, I'm unsure about how to ...
LuciferX's user avatar
1 vote
1 answer
218 views

Ardalis Specification Repository can be injected but when call any method, get object reference error

I use Ardalis Specifications with Entity Framework. I wrote my app in .NET 7 and I use an onion architecture with mediatr pattern. I have a generic interface IRepository and I define it as scoped. ...
Mustafa Ulukaya's user avatar
1 vote
1 answer
106 views

Does repository pattern really provides loose coupling in .NET

I am confused on repository pattern, its DI and loose coupling concept. But in any case if I change in my domain classes or interface contracts or data access layer, I need to change code at other ...
learningdotnet's user avatar
0 votes
0 answers
33 views

How to Deploy a blazor webassembly application that has multi startup projects?

I'm working on a Blazor WebAssembly project with multiple startup projects. One project serves as an API, while the other is the UI. andthe project is built using repository pattern I want to deploy ...
Sara Barzani's user avatar
2 votes
1 answer
132 views

Is there a way to add scoped service which is repository to ASP.NET Core 7 MVC?

I have a category db. I need to build controller part for CRUD operations. I created repository interface, class and also configure the controller part but I can't add the service to Program.cs file. ...
inwolvenstorm's user avatar
1 vote
0 answers
42 views

Firestore Generic Repository

I want to make a generic repository that does operations on a firestore collection that uses maps instead of any POJOs. I have implemented a function that retrieves only the required fields from the ...
MCDragusanu's user avatar
0 votes
1 answer
112 views

Involving domain logic in repository layer. How to avoid it?

In my current application, I have a requirement to create an api GET route "/inactive-users" and it should return users, who were archived ("isArchived") and at the same time were ...
eugenedrvnk's user avatar
-3 votes
1 answer
56 views

Generic Repository using EF

I'm trying to build generic repository which I will use to get data with or without includes, add data, update data, delete data. I searched a bunch of websites, but still nothing to match my requests....
sandro revazishvili's user avatar
2 votes
1 answer
426 views

Trying to Unit Test Generic Repository based on .NET EF Core fails when dealing with DbContext.Entry

I have written a generic repository (BaseRepository), where it's Delete method code is: public virtual void Delete(TEntity entity) { if (dbContext.Entry(entity).State == EntityState....
Themis Zarotiadis's user avatar
0 votes
1 answer
410 views

Laravel 10 Repository Pattern with multiple database connections

TL;DR; How can I get multiple repositories with different DB connections when using Repository Pattern. About Hello, I'm building an API Server using Laravel 10. I choose Repository Pattern for ...
Meow Kim's user avatar
  • 445
2 votes
0 answers
129 views

slow application startup in flutter Getx

I have application that I have been made it by get x state management 
and I added general binding class to inject all necessary classes in my project (
repository/remote data datasource/local data ...
Hassan Hallak's user avatar
0 votes
1 answer
143 views

Cannot read properties of undefined (reading '_userService') when using inversifyJS inject

I'am trying to implement a DI but seems that I'm missing some concepts of Inversify. Do I need to implement the "get" method for "user.controller" and "bind" it to the ...
Lucas's user avatar
  • 25
1 vote
1 answer
67 views

What is the best way to delete and create new related entity in ef core?

I have ef core entity which has related entity. public sealed class MyEntity { public Guid Id { get; init; } public string Description { get; set; } public int? Age { get; set; } ...
fgrd4035's user avatar
0 votes
1 answer
48 views

RxSwift blockingGet equivalent

I'm developing a quite old application and need to handle between new rx way and old legacy threads. I started using repository pattern where all is emitted in Observables. And now I wanted to use my ...
michalp's user avatar
  • 83
1 vote
0 answers
132 views

Hibernate (Panache) Repository Best Practices

I am currently working on a system where we manage a significant number of customers and their associated end-customers. Typically, each of our customers has 1-10K end-customers, but this number can ...
Marcus Biel's user avatar

1
2 3 4 5
64