I'm trying to understand the Repository Pattern, while developing an ASP.NET MVC application (using .NET 3.5, ASP.NET MVC 1.0 and Entity Framework). I've gotten far enough to get the dependency injection and all working with one Controller and one Entity type, but now I've gotten as far as to implementing support for a relation between d...
I apologize in advance if folks think this has been beaten to death. I've just spent the last few hours searching and reading many excellent posts here in SO but I'm still confused.
The source of my confusion is DTO vs. DDD and repositories. I want my POCO domain objects to have the smarts, and I want to get them from repositories. But ...
Hi there,
I have successfully created a asp mvc app which basically has interface, service and dataacces - AKA the repository pattern..
What would be the best way to call my service (my repository pattern) from an MVVM structured WPF app..
From what i see.. in the MODEL in wpf i presume i call my service (repository pattern) from the ...
The reason I ask is because the HttpContext.Current.Items collection seems like it would be a good place to put IDisposable objects such as a DataContext so that a Repository might access it transparently without having to to inject any dependencies related to a specific ORM technology into the Repository. This would also allow the repos...
I am creating RESTful services for several database entities based on a modified version of the BISDM. Some of these entities have associated lookup tables, such as depicted below:
I have decided to use the repository pattern to provide a clean separation between data persistance / retrieval; however, I am not sure how lookups ( as op...
How can I implement the so called "repository pattern" that Rob Conery shows in [MVC Storefront][1] when I use two different generated linq codes? Do I need to implement a real repository pattern as Fredrik Normen discusses at What purpose does the Repository Pattern have?? The thing is that I want pass some of the nice features that LIN...
I have a two repositories Catalog and User, I have a situation where I need to call a method within the catalog repo from the user repo, is this good practice or is there a better way?
...
Guys,
I've been reading both ddd and PoEAA books, and searching a lot on the web but i'm still confused and i think there is something i'm missing about the repository pattern:
Context of use: Web apps (monorail + activerecord)
What i'm looking for:
reuse a 'base' repository among project. The repository will be the typical IReposit...
This is concerning an enterprise application with a very generic database (all objects are identified using data in the database and internationalized/globalized/localized).
Make a model for Repository pattern, then make (generate 1:1) another model for DB access (LINQ2SQL or EF) and use the later as repository model data access layer?...
Hello,
I am trying to learn Asp.net Mvc so I am trying out
this Tutorial.
They talk about the Repository Pattern and how it is easy to change to another data access technology instead of just calling Linq to Sql directly.
Using LINQ to SQL within a controller class makes it difficult to switch data access technologies in the future. ...
Hello
I'm not 100% sure that I've implemented my Repository and UnitOfWork patterns correctly, but then I can't see how else this will work.
For example, I have two objects, Apple and Orange.
Apple is joined to Orange via an OrangeID like so:
public class Apple
{
public int OrangeID { get; set; }
}
I want to create a new Apple a...
I have recently been looking at the Repository Pattern as a way of brushing all the details of persistence under the carpet where the client code is concerned. While reading around it appears that a Repository is/can be [usually?] responsible for aggregates rather than just straight-forward classes.
This make sense to me as you could h...
What is alternative patterns of using for Entity Framework ?
Some I know are:
"Plain" EntityFramework - aka Unity of Work
using (Data.Model c = new Data.Model())
{
var z = c.Users.Where(x=>x.Name=='John');
}
Repository pattern
//Model implements IRepository
User user = Model.Instance.Get<User>(u => u.Name == "John");
What else...
So, I'm using moq for testing, but I ran into a problem that prevents me from mocking correctly, at least I think so.
This is my repository class:
public interface IAccountsRepository
{
IQueryable<Account> Accounts { get; }
IQueryable<Account> AccountsPaged(int pageSize, int selectedPage);
}
This is one of the implem...
We are building an ASP.NET MVC site, and I'm struggling with where to define a connection to best enable unit testing (I use 'connection' generically - it could be a session, a connection, an adapter, or any other type of data context that can manage transactions and database operations).
Let's say we have 3 classes:
UserController
U...
How do you lazy load nested lists without actually executing the query? Using a very basic example, say I have:
class CityBlock {
IList<Building> BuildingsOnBlock;
Person BlockOwner;
}
class Building {
IList<Floor> FloorsInBuilding;
}
class Floor {
IList<Cubicle> EmployeeCubicles;
}
Class Cubicle {
System.Gui...
Hi,
Ok so I 'm just getting into nhibernate (using fluent).
One thing that I love about it is that I can use the Repository pattern (read about it from the nhibernate rhino blog).
Basically using generics, I can create methods that will work accross ALL my database tables.
public interface IRepository<T>
{
T GetById(int ...
In an ASP.NET MVC application implementing the repository pattern I am curious if it is appropriate to place non-data related methods in the repository if they still pertain to the general focus of a given repository. For example, suppose a ProductsRepository that has methods for adding and deleting ProductImages which have a partial rep...
I have been pondering for a while how to best cache IQueryables. I am using a repository pattern to fetch data into a class such as this one:
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public IQueryable<Category> { get; set; } // For simplicity. It is actually a LazyList<Category> contai...
I am working on a repository pattern where the API look as follows:
var visitor = repository.Find(x => x.EmailAddress == credentials.EmailAddress &&
x.Password == credentials.Password);
where visitor is a domain object and x represents this domain object. The method signature of the Find method on the re...