Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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]

1
vote
1answer
177 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
189 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
1k 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
140 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
4k 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
250 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
174 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
470 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
76 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
161 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
91 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
335 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 ...
0
votes
0answers
356 views

Should the service layer be database implementation agnostic?

I'm rebuilding an already existing application I've built before and I would like to implement a few patterns in as a good manner as possible. I'm experimenting with two dabase types, where I ...
3
votes
1answer
626 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
659 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
984 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
130 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 ...
5
votes
2answers
1k 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
211 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. ...
4
votes
1answer
201 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 ...
3
votes
1answer
667 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 ...
5
votes
1answer
482 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
71 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
118 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 ...
4
votes
1answer
798 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 ...
5
votes
1answer
4k 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
330 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 ...
0
votes
0answers
81 views

Changes across repositories and branch names - Best Practice

I need to make some changes that are going to take place over a few repositories. When creating new branch names for each repository is it recommended to give the branches the same name in each ...
4
votes
1answer
225 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
863 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 ...
2
votes
0answers
52 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
292 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. ...
0
votes
0answers
90 views

Correct place for linq to DB requests in MVC app

Currently i see linq requests everywhere in solution(controllers, helpers, business logic, repositories). I would like to store all of them at one place(hope this will prevent duplicates and make ...
2
votes
1answer
681 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
763 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
148 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
271 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
115 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
97 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
945 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
2k 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) ...
1
vote
1answer
265 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
0answers
585 views

How to create a reference library of c# class libraries and projects [closed]

We have a large LOB application that does fairly complex transaction processing of various types. All our code is written in C# and consists of class libraries, console apps, windows forms apps and ...
0
votes
1answer
492 views

How can you have a Repository with dynamic data-sources?

Usually the Repository pattern looks like : What would be the best practice to make the repository handle more gateways (for Cache Redis, FTS/filtering Elasticsearch, Db Mysql etc.) My ideas so far ...
1
vote
2answers
87 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/...
-3
votes
1answer
198 views

Git Repository design questions

I have following hierarchy of topics I am working on DataStructure Linked List Array Stacks Tree Enterprise Apps EJB JMS Android App Games Productivity Apps My question is how can I best ...
2
votes
0answers
384 views

Multiple Entity Business Logic/Changes, C# MVC Repository Pattern

I have a standard C# MVC project which has a domain layer using EF and repository pattern. Say I have a model like: public class MainModel { public int MainModelID {get; set;} //Many other ...
0
votes
1answer
101 views

Questions regarding my MVC application

I'm learning .net MVC while developing a simple word list - Eg. When you learn a new language and create a list of words related to a certain topic. I don't think I'm following the rules or good ...
5
votes
2answers
835 views

Should repository have a method for every specific database operation?

When following the standard service and repository patterns, should your repository contain a specific method for every database operation or should you just use the general methods, e.g. update? Take ...