repository-pattern

SubSonic 3.0 - Save method with all columns as parameters?

Hi, Just getting started with SubSonic. I'm using the Repository pattern, so my domain objects are totally seperate, and SubSonic-generated classes are used only in my data access layer. I'm wondering if a template exists that will give me a Save method (Insert/Update) that requires all table column values as parameters. My thinking is ...

Repository Pattern Standardization of methods

All I am trying to find out the correct definition of the repository pattern. My original understanding was this (extremely dumbed down) Separate your Business Objects from your Data Objects Standardize access methods in data access layer. I have really seen 2 different implementation, and there are no formal examples online, the on...

How to do role-based access control for a franchise business?

I'm building the 2nd iteration of a web-based CRM+CMS for a franchise service business in ASP.NET MVC 2. I need to control access to each franchise's services based on the roles a user is assigned for that franchise. 4 examples: Receptionist should be able to book service jobs in for her "Atlantic Seaboard" franchise, but not do any r...

C# Inheritence: Choosing what repository based on type of inherited class

I have been making a program that downloads information about movies from the internet. I have a base class Title, which represents all titles. Movie, Serie and Episode are inherited from that class. To save them to the database I have 2 services, MovieService and SerieService. They in turn call repositories, but that is not important h...

Fluent NHibernate Repository with subclasses

Having some difficulty understanding the best way to implement subclasses with a generic repository using Fluent NHibernate. I have a base class and two subclasses, say: public abstract class Person { public virtual int PersonId { get; set; } public virtual string FirstName { get; set; } public virtual string LastName { get...

Is this a right way to use NHibernate?

I spent the rest of the evening reading StackOverflow questions and also some blog entries and links about the subject. All of them turned out to be very helpful, but I still feel that they don't really answer my question. So, I'm developing a simple web application. I'd like to create a reusable data access layer which I can later reus...

GIT repository layout for server with multiple projects

One of the things I like about the way I have Subversion set up is that I can have a single main repository with multiple projects. When I want to work on a project I can check out just that project. Like this \main \ProductA \ProductB \Shared then svn checkout http://.../main/ProductA As a new user to git I want to exp...

Should Save/Update repository methods use a new data context?

Should each save/update method in a LINQ-to-SQL repository be wrapped in a new data context? Consider the SavePage method in my partial SqlPageRepository: public class SqlPageRepository : IPageRepository { private DB _db; public SqlPageRepository(DB db) // I use IoC { _db = db; } public IQueryable<Page> Ge...

Multi-tenant Access Control: Repository or Service layer?

In a multi-tenant ASP.NET MVC application based on Rob Conery's MVC Storefront, should I be filtering the tenant's data in the repository or the service layer? 1. Filter tenant's data in the repository: public interface IJobRepository { IQueryable<Job> GetJobs(short tenantId); } 2. Let the service filter the repository data by te...

NHibernate with or without Repository

There are several similar questions on this matter, by I still haven't found enough reasons to decide which way to go. The real question is, is it reasonable to abstract the NHibernate using a Repository pattern, or not? It seems that the only reason behind abstracting it is to leave yourself an option to replace NHibernate with a diff...

How much to put in a Repository class?

When using the repository pattern is it recommended to have one Repository class for each database table? Would I also map one service layer class to one repository class. I'm having a hard time trying to understand how much stuff one repository or service layer class should have. Thanks! ...

Repository vs Data Access

Hi guys In the context of the n-tier application, is there a difference between what you would consider your data access classes to be and your repositories? I tend to think yes but I just wanted to see what other thought. My thinking is that the job of the repository is just to contain and execute the raw query itself, where as the d...

nhibernate fluent repository pattern insert problem

I am trying to use Fluent NHibernate and the repository pattern. I would like my business layer to not be knowledgeable of the data persistence layer. Ideally I would pass in an initialized domain object to the insert method of the repository and all would be well. Where I run into problems is if the object being passed in has a child ...

Which collection type should a reposity return results in? (.Net)

When using repository based persistence in a .net application, which collection type should normally be used? IList, IEnumerable? For example, the FindAll() method. ...

Entity Framework's object graph & Repository Pattern

The repository pattern typically has Get*() and Save() (or equivalent) methods for each object. How does this fit into the object graph in EF? Consider the following with lazy-loading POCO objects: // EF var orderItems = context.OrderItems.Where(oi => oi.Order.Id == 123); // Repository IOrderItemsRepository orderItemsRepository = new...

Best Practice, objects design ASP.NET MVC

Hello Stackoverflow I have a code design question that have been torbeling me for a while, you see I’m doing a refactoring of my website Cosplay Denmark, a site where cospalyers can upload images of them self in their costumes. The original site was done in php, Zend MVC, but my refactoring is being done in ASP.NET MVC 2. If you take t...

What is good practice in .NET system architecture design concerning multiple models and aggregates

I'm designing a larger enterprise architecture and I'm in a doubt about how to separate the models and design those. There are several points I'd like suggestions for: - models to define - way to define models Currently my idea is to define: Core (domain) model Repositories to get data to that domain model from a database or other sto...

Entity framework using Data Repository pattern - DeepLoading

Hi all, I have been implementing a new project which I have decided to use the repository pattern and Entity Framework. I have sucessfuly implemented basic CRUD methods and I have no moved onto my DeepLoads. From all the examples and documentation I can find to do this I need to call something like this: public Foo DeepLoadFoo() { ...

ASP.NET MVC - How to Unit Test boundaries in the Repository pattern?

Given a basic repository interface: public interface IPersonRepository { void AddPerson(Person person); List<Person> GetAllPeople(); } With a basic implementation: public class PersonRepository: IPersonRepository { public void AddPerson(Person person) { ObjectContext.AddObject(person); } public List<...

How to inject ninject itself into a static class with extension functions.

I got some static classes with extension methods which add 'business logic' to entities using the repository pattern. Now sometimes i need to create a new IRepository in these extension functions. I'm currently working around it by accessing my Ninject kernel through the object I'm extending, but it's really ugly: public static IEnume...