After working with ASP.Net MVC, it has me thinking about Rails. I worked with Rails prior, but am a little rusty. ASP.Net MVC tutorials recomment hiding data layer implementation with the repository pattern. This allows easiesr Dependency Injection for Unit Testing, and nice decoupling of the controller from the model implementation. ...
Hi everybody!
I think i have some design errors in my ongoing web project (i'm using Linq2SQL implementing repository pattern)
1) Every repository creates its own DataContext (is this correct?should this be this way)
For example:
public class SQLPersonRepository : IPersonRepository
{
DataContext dc;
public SQLPersonRepository(s...
I'm very new to the Entity Framework and trying to understand how to best architect my data layer in way that makes the most sense from the prospective of a developer. I'm working on a proof of concept using the AventureWorks database. I built a generic repository that I use to query any table in the database. Following is a short, but c...
I have started upgrading one of our internal software applications, written in ASP.NET Web Forms, and moving to ASP.NET MVC.
I am trying to leverage the Repository design pattern for my classes, which leads me to my question about how much to put into a repository.
I have the following entities:
Topic
Topic Comments (Topic can have...
I am finishing up a rewrite of a project management tool using ASP.NET MVC, LINQ2QL and the Repository design pattern. Pretty much following the NerdDinner example.
I have a class called Task that has a child list of TaskStages. For sake of this example the Stages are Ready, Under Development and Completed. I keep track of the current...
In the nerd dinner, they use partial keywords to overload the Linq to SQL classes to embed the data validation.
Let's say you want to data validate exclusively in the repository. Is there some website link out there that shows how to construct this in a way that can feed the Html.Validation helpers seamlessly?
I heard this is changing...
I had a client ask for advice building a simple WPF LOB application the other day. They basically want a CRUD application for a database, with main purpose being as a WPF training project.
I also showed them Linq To SQL and they were impressed.
I then explained its probably not a good idea to use that L2S entities directly from their B...
Hi,
I'm trying to be a better developer...
What I'm working with:
.Net MVC Framework 1.0
Entity Framework 3.5
I've been doing some reading and I think what i want to do is:
Create a repository for each aggregate in the domain. An Order repository for example will manage an Order's OrderItems.
Create a service layer to handle busi...
I have an application with a repository layer (and a nhibernate implementation), service (bussiness) layer, and an asp.net mvc in the web layer.
Because I also need to create a small silverlight application I will create several wcf services. This calls to use DTO's, but I don't know how & where to create them.
I've seen some links (li...
I really like these two patterns.
The drawback of Repository pattern is its cost(takes more time then Active record). Benefit is higher abstraction which really helps on complicated business logic.
The drawback of Active record is that lower testability(db interaction is required) and harder in handling complicated domain logic.
Is it...
I think I am very close to assembling an MVC repository correctly but just falling apart at the fringe. I created an MVC project with a repository and am returning data successfully, but not accurately as it pertains to DDD. Please tell me where I am incorrect in terms of strict DDD assembly. I guess if the topics are too wide, a book...
What is the difference between the terms factory, provider and service?
Just getting into nhibernate and its repository pattern (POCO classes, etc).
...
I'm working on a modification to a site to allowing users to enter content. However, once they've created that content it needs to be approved before it can be published. This is fairly easy to achieve by having a "moderate" bit set in the record for that content and only one table is needed.
Now I also want to allow users to edit the c...
I use DTO's to map between my Business and Entity Framework layer via the Repository Pattern.
A Standard call would look like
public IClassDTO Fetch(Guid id)
{
var query = from s in _db.Base.OfType<Class>()
where s.ID == id
select s;
return query.First();
}
Now I wish to pass in filtering criteria from the bu...
I have an ASP.NET MVC app with a primitive repository layer that currently serves LINQ to SQL entities back to the controllers which then send them to the views. I now want to start using some domain-centric objects in place of my LINQ to SQL entities, and I have been using AutoMapper to help accomplish some of this. For simple propert...
for example:
class repository {
private DataContext db = new DataContext();
public IQueryable<Blah> someMethod(int id){
return from b in db.Blah ... select b;
}
public IQueryable<Blah> someMethod2(int id){
return from b in db.Blah ... select b;
}
public IQueryable<Blah> someMethod3(int id){
...
I'm trying to get my head around how to properly use the repository pattern. The central concept of an Aggregate Root keeps coming up. When searching both the web and Stack Overflow for help with what an aggregate root is, I keep finding discussions about them and dead links to pages that are supposed to contain base definitions.
In the...
Pros:
Repositories hide complex queries.
Repository methods can be used as transaction boundaries.
ORM can easily be mocked
Cons:
ORM frameworks offer already a collection like interface to persistent objects, what is the intention of repositories. So repositories add extra complexity to the system.
combinatorial explosion when usi...
I'm refactoring existing class to support Products import from CSV file.
Requirements:
1) during import products are identified by special product number.
2) product has category attribute. If such category exist - use its id, if not - create it first.
3) if product with some number already exists in DB - do an update of other fie...
Hi,
I need to write a test layer to Test my WCF RIA Domain Service layer which is build on top of Entity Framework context. I have come across some patterns which suggest to use a repository and then use the Domain Service factory to intilize the domain service with a repository instance to use. One of the sample which fits the requirem...