Questions tagged [repository]

A repository provides a storage mechanism for digital products. May refer to [version-control] like [git] or [svn]. An application specific tag should be used with this tag in order to identify the specific repository management interface that is being used unless the question is general in nature. See also: [repository-pattern]

Filter by
Sorted by
Tagged with
2
votes
2answers
717 views

Object To Be Used By Service Layer

My project has a UI layer, a Service Layer and a Repository layer. The latter has Entity objects as part of the ORM (.net Entity Framework). The service later returns a Dto to the UI layer. My ...
7
votes
2answers
2k views

monorepo - Single monorepo for multiple large-scale, company-sized projects

I'm in need of some advice before going foward. I want to build several large scale projects, like a marketplace product, and a few domain-specific products and libraries. The products may or may not ...
4
votes
3answers
260 views

How to notify a repository about persistence changes

I have a repository, which at the moment, reads from the database every time it is called. However, the data is only updated once a day, and to improve performance, I'd like the repository to store ...
2
votes
2answers
803 views

Best practice to keep different data sources in sync?

I'm having doubts about how to implement and keep synchronization between two datasources in a distributed system. In my case, I have a service that checks for expired jobs in a repository. If the job ...
2
votes
2answers
2k views

DDD: should entity method use repository for stored procedures (not CRUD)?

Imagine you have a Vehicle entity in your domain model. Vehicle entity has Reserve method that put vehicle in "reserved" state and do another stuff. But Reserve method have to do some checking first ...
1
vote
1answer
981 views

Avoid core layer referencing DAL when defining repository interface

I'm trying to learn the N-Layer architecture and several other things, and I have a C# solution where I have the following layers: Core/Infrastructure (Folder) Core (Project) ...
1
vote
2answers
4k views

Calling a service method from another service method

In the repository pattern, is it a "bad idea" to call a service method from another service method? In most cases, I naturally end up calling repository methods from my service methods. However, in ...
5
votes
1answer
550 views

Using SQL for DDD Persistence - Is Referential Integrity Mandatory?

I am writing DDD bounded contexts with some entities using event sourcing for their persistence and other entities using SQL databases. To simplify writing of the entities that use SQL persistence, ...
2
votes
0answers
665 views

Python and C++ repository structure

I'm refactoring the directory structure of a large Python repo that has a few dozen C and C++ files littered throughout. Is there a suggested architecture for a Python package that contains C/C++ code ...
1
vote
1answer
261 views

Should a repository transform data into the correct model?

I have some data in my ERP that is formed in a very odd way (think a HTML field that contains many different fields, formatted in HTML that need to be pulled out using XPath). Is the transformation ...
3
votes
1answer
666 views

How to design my repositories when there are multiple sources for the same sort of data?

In my application, I have to get data from our ERP. For this example, let's say product data. Some of the data will come from the API that our ERP has provided us, whilst some of it will come from ...
1
vote
1answer
243 views

Object oriented way of interacting with persistence layer

I have a hotel entity which has a set of images. I have some business rules which are basically simple crud operations right now. I have heard of repository pattern but working with it I feels like ...
-1
votes
1answer
216 views

How to maintain multiple or single repositories of a project developed by multiple people?

A while ago, I asked what are cons and pros between the two version control designs of a project: multiple repositories, vs single repository When a project has a single git repository and developed ...
0
votes
2answers
2k views

Can not understand how dependency injection can ease testing inside asp.net MVC

Each time i read an article or a book about asp.net MVC , there will be a chapter for dependency injection and repository . now i can easily feel the benefits of using repository over hard coding the ...
4
votes
2answers
142 views

README “Setup” section best practice?

In the SETUP section of my README, should I just link to instructions for each dependency like this: STEPS install Appium (guide) install XYZ (guide) Or should I reproduce all their instructions ...
1
vote
2answers
6k views

Should I mock Repository and Unit Of Work for Unit Testing?

I have read this article: https://www.gaui.is/how-to-mock-the-datacontext-linq/ Since this article is almost 4 years old I have no hope that in article's comments my question will be answered so I ...
6
votes
4answers
254 views

Storing directly in the model

Normally when I have some data to store, I do something like Model model = new Model(); Notifier notifier = new EventBus(); Store store = new DataStore(); model.updateTitle("new title"); store.save(...
0
votes
1answer
195 views

Does this Repository code violate SRP and DRY?

After reading this Stackoverflow question I have stumbled upon an MSDN article Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application. There is a proposed implementation ...
2
votes
1answer
568 views

git: multiple repositories but still “grouped”

I have a rather simple application which consists of an angular frontend and a REST API done in C# For the frontend I use WebStorm and for the backend Visual Studio. Now we need to introduce a new ...
1
vote
1answer
78 views

Add a key-invariant ICrudRepository which can be implemented by ignorance

In this example, TItem.GetKeyType() is what I'd like to achieve. Base CRUD repository interface definition: ICrudRepository<TItem> where TItem : BaseItem where TKey : TItem.GetKeyType() public ...
1
vote
1answer
163 views

Should ALL database methods be in the repository?

Let's say I have a UserRepository. It has the basic CRUD methods. According to the Repository Pattern, should it contain methods like IsAdministrator(user) to check against the database if a user is ...
-1
votes
2answers
114 views

How to create a generic client to query an API and return different types based on API call?

I am building a repository that will request data from an API. Originally, I had multiple methods in my repository such as GetOrders(), GetOrderItems() etc. The majority of these functions had almost ...
1
vote
2answers
436 views

Should my repository or service be responsible for joining multiple API calls into one object

I am implementing the repository pattern in my application. The repository will connect to an API to download orders from an external API. The API that I am connecting to has a separate endpoint to ...
3
votes
1answer
742 views

Does the Spring Data Repository implementation violate the principle of loose coupling?

So, at the moment I find myself building my c#/.net (web) application ( or folder/project/package-...) structure often like this, thinking about it in a "somewhat onion-architectural way": myApp -...
0
votes
2answers
853 views

Is a facade repository an OK design?

I need to design code for a complex multi-table update, ideally using a repository pattern to fit in with existing code structures. Some of the tables which will be updated are specific to this flow, ...
1
vote
2answers
1k views

Should a factory always create a new object

we have a hierarchical structure where every node is derived from a node base class public Node(INodeFactory nodeFactory). The factory is injected so the node can create its child nodes using Get(int ...
3
votes
0answers
157 views

How to avoid maintaining database context over long periods with the repository pattern (And is this even a sensible Architecture?)

I'm trying to build a 'distributed' data system. My first attempt is built using Entity Framework. Very loosely, it's built around having Element objects, which themselves have a group of Property ...
4
votes
2answers
2k views

In MVP, should we call repositories from the Model or the Presenter?

Note: The example in this question is for demonstration. Please focus on the question and not on problems in the example (such as tight coupling, lack of Dependency Injection etc.). I have a form to ...
3
votes
2answers
263 views

Should I nest repositories like Russian dolls?

tl;dr Can I have a repository depend on another repository, where they both implement the same interface? I am working on a website analytics system that involves getting data from different sources. ...
3
votes
1answer
253 views

Git structure on production server

So I want to add our git repo to the server so that we can pull in the latest changes from the master branch and easily update the live sites via SSH. I don't want changes tracked by Git on the live ...
2
votes
1answer
741 views

How do you define Domain Objects and Repositories, when dealing with multiple database tables?

Imagine an application that allows you to add line items to a quote. The end result is like a sales person giving you a printed sheet with information such as name of the business, name of the sales ...
4
votes
1answer
538 views

How to design a repository pattern that can handle per-use-case relational data loading?

We're designing a major refactor in my company system's codebase. One of the refactor points, is the (actual) definition of the business logic/domain model. Right now, every repository in the codebase ...
0
votes
1answer
73 views

What is the best way to dictate to a repository which result object properties to populate and leave the others null?

I am working on a Domain Driven Design project and I have the following problem. I am trying to create a repository that returns a list of objects. The objects have 15 - 20 properties and according ...
3
votes
2answers
119 views

Vendoring part of my repository in someone else's project

I have a repository for a project that contains both an executable and a library. My repo |->src |->my-exe |->my-lib I am now working with a company that wants to use my library in ...
3
votes
1answer
1k views

How does the Aggregate Root concept and the Repository Pattern solve DRY in database operations?

If I have ten classes, and they all need CRUD operations, how does an Aggregate Root and the Repository Pattern solve me having to write lots of boilerplate code (the DRY)? Take the example of a ...
6
votes
1answer
6k views

What is the purpose of domain/business logic in classes when having repositories?

From my experience I think that having classes/models without behaviour only in my application, next to their repositories is not good OOP. But, this was the way I implemented the repository pattern. ...
7
votes
1answer
4k views

Repository Pattern and database queries

Having read others posts, it already seems to me that the concept "repository" and "database" do not go well hand in hand, as they are meant to be completely separate concepts.... but I'll ask the ...
0
votes
1answer
388 views

In ASP.NET MVC Core do CRUD operations follow the Repository Pattern?

In some MVC frameworks I've used the Model has the method and SQL in the Model so that if you call the controller, it invokes a method on the model class (say Products), and it returns the data. In ...
3
votes
1answer
249 views

Joining table with table from external database/API

For a prototype project I've created an Angular 2 application with simple CRUD functionality using Auth0 to handle authentication with a back-end containing a Web API (core), Service and Repository ...
4
votes
3answers
1k views

How do I describe the Repository pattern?

I'm currently working on the project with the new team and they are using Repository pattern which is new to me. In this repository, they're currently doing 1.If we are offline, we will load data ...
3
votes
0answers
58 views

How is a repository supposed to get internal state of an aggregate without ORM in DDD context? [duplicate]

Domain objects (aggregates and entities) are only exposing behavior and no dummy getter() or setter() methods. If I don't want to use an ORM in a repository which is capable of extracting internal ...
1
vote
1answer
373 views

Best practice to revive and update old branch?

I'm a solo hobbyist developer with some code hosted on Bitbucket. I use TortoiseHg client-side for managing my repo. Back in 2013 I developed a feature on a branch but abandoned it before completion. ...
2
votes
1answer
776 views

When to create an in-memory object to manage repository records?

Suppose I have a conceptual Ledger that is populated with Line Items. Assume that Line Items themselves are stored in some type of persistent storage. The ledger is shown to the user who can add/...
3
votes
2answers
959 views

Am I breaking SRP when I inject Factory pattern with Repository layer?

In the context of MVC sometimes I find myself creating a Factory and injecting the factory with Repository. While it is certainly possible to use Repository as layer inside the Factory, I wonder if ...
2
votes
3answers
151 views

Do products of a build process belong in a repository?

For example: we don't put python compilation files (.pyc's) into the repo, probably because python generates them automatically. In a java house, do they commit the .jars to their repos? ...
2
votes
1answer
272 views

Storing/hosting sensitive business data

In order for users of my software to receive auto-updates, their copy of the software will need remote access to ~100mb of private files (manifest, jars) which means I need a server. Currently I don't ...
3
votes
2answers
116 views

Abstracting Repository

Suppose that I have an object used by my code, say Person: public class Person { public string Name {get;set;} public Address Address {get; set;} } public class Address { public string ...
3
votes
1answer
104 views

in which layer should “partial” BL method be placed?

I have a project and I follow Repository and UoW patterns. I also have a "service" layer which I also use as my BL layer. Taking for example a Customer domain model, I might have information that I ...
4
votes
2answers
1k views

Pure POJO refactoring Active Record Pattern using Repository Pattern, no ORM or DI frameworks for pedagogical reasons

I taught a course years ago, and then I used some JDBC exercises using what I now know is the Active Record Pattern. I would like to modernize the exercise by changing the Active Record Pattern so ...
4
votes
1answer
3k views

Java DDD project organization

Just wanted to hear opinions on this kind of project structure in java for one DDD project: com.some.namespace application services = (app services that talk to repositories and domain model) ...