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]
255
questions
2
votes
1
answer
1k
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 ...
2
votes
1
answer
1k
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/...
2
votes
1
answer
283
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 ...
2
votes
1
answer
427
views
What is better repository design?
I have tables that I insert, delete and update, but I read from views. At times, I may read from the tables as well. What is a better generic interface for a Repository:
public interface ...
2
votes
1
answer
113
views
Can tags be used as bookmarks under semantic versioning?
Shameless plug: this question is for StackMode – a StackExchange client for GNU Emacs 24+.
The product I'm working on, version-controlled with git, is a desktop application with an innately exposed ...
2
votes
3
answers
470
views
Repository matrix pattern?
I'm trying really hard to refactor some of my legacy code in the project using best practices and design patterns + DDD so I'd love some feedback on an issue I'm currently having.
Let's assume that I ...
2
votes
0
answers
296
views
Changing entities in Clean Architecture
I'm modeling the "Domain" Layer of "Clean Architecture" for an application that gets its data from an XML file when starts.
The XML file looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<...
2
votes
2
answers
1k
views
Repository Pattern and custom queries/REST API. Is it the right approach?
I'm in the early stages of working on an application that is using the Repository Pattern to provide a data access abstraction. This application will have some form of a simple REST API but I'm not ...
1
vote
3
answers
314
views
Is there any value for a repository to return an iterator rather than a list?
I see a pattern where the get method from a repository returns an Iterable, even if the list is composed already:
def get() -> Iterable[type]:
my_list = [list]
for x in my_list:
yield x
I'...
1
vote
2
answers
104
views
Making utilities discoverable
I am currently working a data science team, and we write small utilities all the time to consolidate data, extract data, etc (an example is go through a folder of excel workbooks, convert all the ...
1
vote
2
answers
1k
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 ...
1
vote
1
answer
197
views
Git Branching and Merging Strategy for Feature-Oriented Release Process
We have multiple developers contributing to a project, using Git as our repository. We have a QA branch that matches our QA environment and a master branch that matches production.
Features can be in ...
1
vote
1
answer
1k
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
2
answers
13k
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 ...
1
vote
1
answer
184
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
vote
2
answers
1k
views
Should a repository be passed in to the User Interface
In Mark Seeman's Dependency Injection in .NET he injects a repository into his UI layer. I believe that he is doing this so that he can store everything in the UI configuration, however this just ...
1
vote
4
answers
301
views
Storing both a compiled service for a Docker container as well as the container in a repository. Good practice, bad practice or no precedent?
This has erupted from quite a turbulent meeting between two senior developers, a lead developer and an engineering lead, and after 90mins reached no resolution.
We create Spring Boot Java services ...
1
vote
1
answer
2k
views
DDD Aggregate in PHP — how to retrieve the root?
Status quo
I created an aggregate, let's call it Foo. It has two entities within itself, let's call them Foo & Bar.
You can mutate things by calling the aggregate's public methods. E.g. $foo->...
1
vote
1
answer
577
views
Git strategy for separate teams in one project without access to eachother source
We have one project and separate teams which work on separate modules. What we need is a strategy that allows our teams to work on one project but without access to each other source codes.
one ...
1
vote
2
answers
3k
views
Updating the db in the repository from a DTO in a layered architecture
Given a Person model:
Person {
int PersonId;
string Name;
string Email;
}
and an UpdatePersonDto which just updates the Name
UpdatePersonDto {
int PersonId;
string Name;
}
How ...
1
vote
4
answers
338
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
2
answers
2k
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 ...
1
vote
1
answer
2k
views
Commercial Apps with an Open Source on github [closed]
I am going to be launching a small web service soon and was wondering if it's a good idea to upload the code to a public github repo.
The code will not be licensed for commercial use but the public ...
1
vote
2
answers
136
views
Specific get cases - Repository vs Service
I have a custom repository for each entity/module (I'm working with NestJS). I know that this is a lot of repeated code and I may refactor it in order to use a generic repository later, but currently ...
1
vote
1
answer
381
views
MVC Controller calling UoW (unit of work) directly instead of going through Service Layer
Currently im injecting my Unit of Work inside the controller.
I figured out that in most of the designs, controllers calls the service layer and service calls the repository/DAL layer.
Most of the ...
1
vote
1
answer
258
views
Private class in ORM Repository?
Is this a code smell?
I have a repository which connects to a SQL server. This repository uses Dapper to map the results to an object.
I have a method in this repository that checks a result, then ...
1
vote
1
answer
427
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
vote
1
answer
92
views
Are repositories meant just for storing data?
One of the major benefits of the repository pattern is that you can easily switch out implementations for other implementations.
After learning about this pattern I started to make tons of things ...
1
vote
3
answers
806
views
Repository w/ MVVM Pattern: Data Format Check, Where/When, Best Practice?
TL; DR
Where/When to check data format in MVVM + Repository Pattern is the best practice? Any suggestion or theory?
The Scene
Our team is working on an Android Project. We have a MVVM+repo structure:
...
1
vote
1
answer
3k
views
Repository structure for microservices
As part of a larger project, my team is building a microservices API layer. We do not have experience with building microservices so we have been trying to figure out how to go about the project.
The ...
1
vote
2
answers
2k
views
DDD: repository for a nested entity?
I have a AR called User, which has among other entities one called City.
The way I assign a City to a User is:
$user->addCity($city);
The problem comes when a id is given at some Controller ...
1
vote
1
answer
100
views
Handling generic and specific implementation
Normally we have some code that is common for many (if not all) derived classes. An example would be a generic repository (where I could have a generic Add, Remove, Count, Max, Load etc, or a generic ...
1
vote
4
answers
969
views
Use OOP approach for organize the business rules instead of SOA in a small project. Excluding DDD, is there some strategy to do this?
I was talking with a friend another day about OOP in small projects. In the most of projects that me and him worked the SOA was the rule.
Per example, imagine a Order in a SOA application. The ...
1
vote
1
answer
2k
views
Service layer with DTO
I'm refactoring my desing to use a service layer - however I'm confused about how you would pass arguments, when it's only allowed to update certain fields of the entity. For instance I have some ...
1
vote
1
answer
101
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
2
answers
2k
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
2
answers
138
views
Is it a good idea to require passwords in offline applications?
I am developing an application which can install extension modules (plugins, if you will) from APT-style repositories hosted elsewhere. The plugins need not be signed (although the downloads are ...
1
vote
1
answer
2k
views
Repository strategy for multiple interconnected components with small differences
At my work we have multiple products.. productA, productB, ... these products reference multiple components. componentA, componentB.. there are also shared components sharedA, sharedB... etc.. which ...
1
vote
1
answer
488
views
How to organize repositories for a split library?
I have two libraries that implement a protocol: one provides tools for establishing a channel between two parts, and the other provides classes and tools for building and parsing the binary protocol ...
1
vote
1
answer
583
views
Clean Architecture: are repositories always needed?
I'm trying to apply Clean Architecture to a mobile Android App, but I still have some doubts about how to manage API calls.
Currently, the classes are structured like this:
View -> ViewModel -> ...
1
vote
1
answer
850
views
DDD accessing reference values in Domain layer without repositories
So I have built a domain model and some logic into that. I have created two repositories for two aggregate roots.
My question is how to access to the reference data from these layers?. For example, ...
1
vote
2
answers
583
views
Unit and integration testing of microservice architecture
I am investigating how to test a project. Some information about the project:
Microservice architecture, with roughly 20 services. About 10 of them
with a separate database.
We use ServiceFabric
...
1
vote
2
answers
2k
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 ...
1
vote
1
answer
949
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.
...
1
vote
1
answer
555
views
Should I ignore repository for a stored procedure that return flat data (multiple objects as a single one)?
I'm using the repository pattern as the way to access the DbContext in my C# application, however, I have a report that generates an expensive query (actually several queries) because of relationships ...
1
vote
2
answers
212
views
Repository design for different providers
If the goal is to be able to swap out backend DB providers (EF, OleDB, ODBC, etc) then I'm wondering where the different DB CRUD changes? Currently I have an interface (IGenericContext) that has Add/...
1
vote
1
answer
1k
views
Repository Pattern Class Collection examples with Lazy/Eager loading
When implementing the repository it's fairly easy for a stand alone class. Unfortunately, we are unable to use an ORM to manage our data access, so I'm trying to recreate some of the functionality ...
1
vote
1
answer
1k
views
Consuming a rest API that exposes nested objects
I have a series of nested objects, exposed over a REST API, like so:
class Categories
{
int id;
string name;
List<Subcategories> subcategories;
}
class Subcategories
{
...
1
vote
2
answers
4k
views
Correct way to inject dependencies in Business logic service?
Currently the structure of my application is as below
Web App --> WCF Service (just a facade) --> Business Logic Services --> Repository -> Entity Framework Datacontext
Now each of my Business logic ...
1
vote
0
answers
47
views
Optimal package structure - Command Line Interface
I have an ongoing project where the directory structure currently is a mess (github Directory) and I would like to strucure it to eventully create a python package out of it. Below I have outlined a ...