Questions tagged [repository]
For questions about the implementation of the repository design pattern.
145
questions
2
votes
1
answer
17k
views
Table join using the repository pattern
I am new to repository pattern. If I want to join two tables, where should I implement the logic? I have implemented it as shown below. Is there any better way to achieve the same?
This is my ...
0
votes
1
answer
541
views
Separate business logic from Data Access Logic in the repository
I have a PupilService which is calling the PupilRepository.AttachPupil() method.
I have an N to M relation between ...
2
votes
1
answer
3k
views
MVC Repository Insert Using async
This is practically my first time using async in my code. I read about dos-and-donts but I wanted to get some feedback on what I've written.
I'm using a repository ...
0
votes
1
answer
173
views
Awkward Generic Repository Call [closed]
I am implementing a generic repository pattern. I have done this quite a few times now but every time I do it there is something bugging me.
If I have a database design like below. (All the tables ...
10
votes
2
answers
15k
views
Manage connection without 'using' statement
I replace this common statement:
...
2
votes
1
answer
2k
views
Replacing IUnitOfWork with a Factory Pattern
As a follow-up to this blog post and this question, I wanted to post my idea of replacing the IUnitOfWork with a factory pattern. It seems to me that in the case of this blog post the IUnitOfWork ...
6
votes
2
answers
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 ...
3
votes
2
answers
403
views
MVC4 Unit Of Work with Entity FrameWork
I am designing a new asp.net MVC4 application. I know that context class generated by EF is Unit of work and Dbset is the repository class. I am just avoiding the extra abstraction. I want to know ...
3
votes
1
answer
297
views
Derive currency conversion rates from database, keep it available in a class
I would like to know whether I applied the SOLID principle and the repository pattern the right way.
My code should derive exchange rates from a database and do basic currency conversions.
The ...
6
votes
1
answer
8k
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
...
3
votes
2
answers
1k
views
Generic repository object design + static DAL helper
I would like you to review the solution I came up with to the following scenario:
In attempting to model a generic Repository object (that receives a generic type parameter) to interface with my data ...
12
votes
1
answer
8k
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
...
2
votes
1
answer
4k
views
Calling Stored Procedure "insert query" using EF 6, UOW, and MVC 5
I'm a beginner in MVC programming, repository, and UOW using Entity framework. I tried to calling my existing SP in my MVC project using UOW and EF.
Here is my code to mapping my SP in myDbContext ...
2
votes
1
answer
479
views
Controller for repository of members
I tried to implement the Repository pattern for my project:
MemberController.php -- this one is a bit too long and has repetitive code
...
2
votes
1
answer
1k
views
IRepository Pattern - Interface Segregation Principle
I have an IRepository class that I use a lot. But I noticed that for many of my repositories I do not implement most of the methods. Also, I usually don't have a ...
28
votes
2
answers
16k
views
Reusable Unit Of Work Interface / Factory
Given my IUnitOfWork interface
using System;
public interface IUnitOfWork : IDisposable
{
void Commit();
}
I then ...
2
votes
1
answer
163
views
Connecting to an insurance database
I'm developing an Android application which would remotely connect to an insurance database and perform some basic CRUD operations and I'd like to learn how to keep clean app's architecture from ...
5
votes
2
answers
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
3
answers
5k
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 ...
8
votes
1
answer
1k
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 ...
3
votes
1
answer
1k
views
WPF Binding to a Repository with Entity-Framework
I have an MVVM WPF application that will make use of a repository and unit-of-work.
This is my Entity Framework database-first model:
...
3
votes
3
answers
606
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 ...
13
votes
5
answers
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 ...
5
votes
2
answers
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.
...
4
votes
1
answer
912
views
Ruby Repository Pattern
I am trying to teach myself about repository pattern in ruby. Could you please review my code.
adapter.rb
...
38
votes
2
answers
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 ...
15
votes
2
answers
39k
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 ...
3
votes
1
answer
2k
views
Make a testable DAL using service and repository pattern
I'm implementing a Web API that communicates with old WCF services and want to make it future proof.
The Web API consists of:
API controllers
Service Providers
Repositories
I've implemented a ...
10
votes
2
answers
185
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 ...
7
votes
1
answer
1k
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 ...
6
votes
2
answers
292
views
Repository implementation
I have a repository called PostsRepository:
...
4
votes
1
answer
768
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 ...
3
votes
1
answer
2k
views
Refactoring fat ASP.NET MVC Controller
I have just began porting an old project to ASP.NET MVC . In the end, I'll have a lot of controller methods like the one below, called by AJAX requests done by JQGrid objects in the pages:
AJAX ...
2
votes
1
answer
190
views
Is this Repository/UOW design workable?
I'm using VS 2013/EF 6/WEB API 2.
This application of mine which is working on will eventually grow to be big project and I'm in the very beginning stage and need your expertise to make it simple as ...
14
votes
2
answers
2k
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 ...
5
votes
1
answer
13k
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 ...
6
votes
1
answer
10k
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 ...
5
votes
2
answers
7k
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.
...
7
votes
1
answer
4k
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 ...
3
votes
2
answers
2k
views
A flexible unit-of-work + repository pattern
Searching on Stack Overflow and Google, I find many and many different implementation for Unit-of-Work/Repository patterns, but none of that really convinced me; each had some small defect that ...
7
votes
2
answers
25k
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.
...
4
votes
1
answer
318
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 ...
8
votes
1
answer
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 ...
13
votes
5
answers
20k
views
Disposing the Context in the Repository pattern
I have a question about the Repository pattern:
...
1
vote
1
answer
1k
views
Repository wrapper
The following implementation is of a repository proxy.
I will post only the code for NHibernate Repository here. Everything else (including configurers and tests) ...