Questions tagged [repository]

For questions about the implementation of the repository design pattern.

Filter by
Sorted by
Tagged with
37
votes
2answers
3k views

KISS my… unit of work

I've seen many, many UoW+Repository implementations. Whenever one was built on top of Entity Framework, I'd cringe at the added complexity. Sure the complexity buys you (sometimes) full decoupling ...
24
votes
2answers
12k views

Reusable Unit Of Work Interface / Factory

Given my IUnitOfWork interface using System; public interface IUnitOfWork : IDisposable { void Commit(); } I then ...
15
votes
2answers
33k views

Unit of work + repository + service layer with dependency injection

I am designing a web application and a windows service and want to use the unit of work + repository layer in conjunction with a service layer, and I am having some trouble putting it all together so ...
14
votes
2answers
960 views

YARPI: Yet Another Repository Pattern Implementation

Following-up on this post, I wanted to be able to put a copy of that Excel workbook on a USB key and take it home to keep working on the code a bit (there's more than just one or two tables to ...
13
votes
5answers
13k views

Is this Repository Design Pattern Valid and efficient?

I am using Dapper ORM in my Data access Layer, but I think analysis of the code below doesn't depend upon any specific ORM. What should be the single common place throughout the entire Data Access ...
13
votes
0answers
489 views

Repository pattern in Rust

I'm looking to add a thin layer of abstraction for database interaction in my application. I'm not really looking for a full blown ORM or advanced query builder. I am familiar with Diesel, but its ...
12
votes
1answer
7k views

Onion Architecture

After doing a whole bunch of research on Onion Architecture, I have made an attempt at implementing this in a new system that we are developing. We have the Layers as per below: Domain ...
12
votes
2answers
249 views

Something like a LINQ provider

Ok, before you ask: yes, I need to do this. Sort of. I'm wrapping a 3rd-party API for data access, and I can't use an ORM, so I'm implementing this kind of thing: ...
10
votes
2answers
11k views

Manage connection without 'using' statement

I replace this common statement: ...
10
votes
2answers
162 views

Disposable Heroes

I had a bit of an issue with my last piece of code, having to do with cleaning up resources. I needed a way to ensure the database connection was always properly closed, even if there still were ...
10
votes
1answer
753 views

Repository Pattern without an ORM

I'm trying to learn the Repository pattern, and I have some questions regarding my current understanding of it. All the examples I've been able to find of database repositories use ORMs, but for a ...
9
votes
3answers
15k views

Disposing the Context in the Repository pattern

I have a question about the Repository pattern: ...
8
votes
1answer
12k views

MVC 5 & EF 6 - Repository & Unit of Work Pattern

I have been looking through Code Review on the subject of Unit of Work and Repository patterns and realised that my implementation appears to provide very similar functionality but in reverse class ...
8
votes
1answer
17k views

EF Generic Repository + Unit of Work pattern with support for Async

I'm working on a generic repository using EF 6 code first and trying to following the Unit of Work pattern. Unity is being used to inject my repositories, and I'm trying to get everything supporting ...
8
votes
1answer
989 views

Building multi-source Repositories and Units of Work

I am working in a shop where we tie into multiple different vendors to share data. I am also tasked with "bringing the code base up to the 4.x framework". To start, I understand that Entity ...
7
votes
2answers
21k views

Implementing repository pattern and DAL with stored procedures

Using .net 3.5, implementation of the repository pattern along with enterprise library 5 and stored procedures. Did not use EF, stored procedures already available and VS2008 is limited to EF 3/4. ...
7
votes
1answer
5k views

Service-Repository pattern with IoC, NPoco micro-ORM and unit tests

I'm trying to build a Web API using best practices, based on a simple proof-of-concept using students. My goal is to build the system using: Onion Architecture to seperate concerns. Service-...
7
votes
2answers
17k 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 ...
7
votes
1answer
919 views

UnitOfWork, an excuse for multiple repositories

I needed a way of attaching multiple repositories to a presenter. Given I already had an IRepository abstraction, coming up with an ...
7
votes
1answer
3k views

Fluent Repository/QueryBuilder

I've been toying around making my repositories a bit more fluent for a while. I was ending up with crazy long method names when I had to query on multiple conditions. So I've been working on a way to ...
6
votes
2answers
275 views

Repository implementation

I have a repository called PostsRepository: ...
6
votes
1answer
71 views

Wrapping the Sage300 View API with… a Repository

Related: Something like a LINQ provider I needed to work with the Sage300 View API. I had never worked with it, but my first impression has been that the API is ...
6
votes
1answer
9k views

Unit of Work / Repository nHibernate

I have a Unit of Work / Repository pattern in place to abstract away some nHibernate. Most examples I've seen though use the pattern a little differently. In ...
6
votes
1answer
7k views

Identity repository pattern with unit of work

I am creating simple web api/ SPA application using EntityFramework, IUnitOfWork, Repository pattern, Unity DI along with Asp.net Identity. Unity configuration ...
6
votes
2answers
2k views

Web API using Repository / UnitOfWork

I'm looking for feedback on a repository I set up based on a blog post I read here. I have just recently got more into .NET within the past year, so any feedback and/or best practices that can be ...
5
votes
3answers
2k views

Unit of Work Pattern for creating users

CreateUser function assumes the data being delivered via parameters are clean and gets called or initiated from the Business Manager (another class). This function is responsible to do the following ...
5
votes
4answers
2k views

Generic Repository For Web Apps

I was developing a web app using Entity Framework 6 and MVC 5. For the data access layer, I eased the job and wrote a generic repository as following: ...
5
votes
2answers
6k views

EF6 Code First unit of work pattern with IoC/DI

I'm trying to implement the unit of work pattern with dependency injection / inversion of control and entity framework version 6.1.1 Code First, in an asp.net-mvc project. ...
5
votes
1answer
12k views

Repository pattern best practices using EF 6

I have been Googling for a few days and am trying to find the best practices when it comes to using the Repository pattern. But what I found that there are no standards and everyone claims that their ...
5
votes
3answers
3k views

Generic repository pattern

Please have a through look my custom implementation of generic repository pattern and suggest anything I may be lacking. I am using a generic interface with 6 methods I'll be using a repository class ...
5
votes
2answers
6k views

Laravel - Repository and Entity patterns

I've spent quite a bit of time studying the repository and entity patterns and this is what I came up with. I would appreciate it if you could post suggestions and critique. ...
5
votes
2answers
7k views

Unit of work Repository pattern DBcontext EF-Entities and ninject

I am totally confused while implementing Repository pattern with unit of work and Entity framework because I have seen tons of examples. Please suggest whether I am on the right track or not. ...
5
votes
2answers
3k 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 ...
4
votes
3answers
516 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 ...
4
votes
1answer
81 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? ...
4
votes
2answers
290 views

Mix of Repository and UOW For Business Library with Entity Per Table Architecture

I am trying to use Entity framework along with UOW in business class where I want to use this layer across multiple types of applications like web, webapi and Windows Services. So I cooked something ...
4
votes
1answer
519 views

eCommerce project using the Repository pattern

I am currently working on an eCommerce project in Laravel 5.1. I have implemented Repository Pattern by learning from this site only for 1 model, namely, ...
4
votes
1answer
668 views

Event sourcing with Python

I've been studying the event sourcing pattern and trying to come up with a set of classes or minimal library I can share across projects. Below you can find the implementation of this main parts of ...
4
votes
1answer
583 views

My implementation of the repository pattern

I'm using this pattern since a few months and I was wondering if I can make it any better. The one thing I am not satisfied about is the dispose method. In every repository I have to add a dispose ...
4
votes
1answer
1k views

Choose the right type for method GetById

I designed my repository class and I need some advice from you. Now I have a method GetByID that returns a generic type: ...
4
votes
1answer
4k views

Returning IQueryable<T> from my repository in Repository pattern design pattern

I am developing an application based on Repository design pattern. What should be the return type from the Repository? This is my UserRepository class: ...
4
votes
1answer
303 views

Saving a sales order - too many repositories?

I am wondering if I have overdone it with repositories in the following code, which is to save a sales order. I understand that the purpose of a repository is to decouple the domain layer from the ...
4
votes
1answer
794 views

Ruby Repository Pattern

I am trying to teach myself about repository pattern in ruby. Could you please review my code. adapter.rb ...
4
votes
0answers
4k views

Hibernate and the Repository Pattern

I have already asked a question on stackoverflow on how to understand the Reporitory Pattern but I'm still having very big troubles in getting a good design implemented on my server. I'm desperately ...
3
votes
2answers
470 views

Cookie repository for self-hosted web service

I use this in a self hosted web service, so I am not using a ton of libraries. I wanted a simple yet easy-to-use cookie repository. The reason the repository is static is that I wanted the ability to ...
3
votes
1answer
2k views

Repository Pattern universal application

When I started learning Repository Pattern with Unity few days ago I was under impression that the main benefit of this pattern is the separation of data layer from the business layer. In other words,...
3
votes
3answers
502 views

Generic data interface

I currently have the following working code. I am looking for some suggestion with best practices and perhaps a better way to accomplish my goal. Goal: - in short - Have a generic data interface as ...
3
votes
1answer
6k 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 ...
3
votes
1answer
6k views

Cached repository implementation for small lists of data models

I have been using Repositories in my ASP.NET MVC projects and I felt the need to fully cache small tables data (dictionaries, cities, countries etc.). This kind of information is changed (very) ...
3
votes
1answer
504 views

Unity Repository Best Practices

I am now developing a product, which will use Unity & Repositories when it comes to data management. I will demonstrate on a simple example. What we want to do, ...