Duplicate:
Learning implementing design patterns for newbies
I have been a developer for years and have my way of developing and have always kept up with the latest techologies. I want to start using a design pattern in the hope it will improve my development speed but I need to find one to apply and I need to find a full open so...
Can anyone recommend good tutorial on repository and Unit Of Work pattern usage for TransactionScope class with Linq ops.in C#?
...
I'm in the process of catching up on technical documentation for a project I completed some months ago, and one I'm coming close to finishing. I used repositories to abstract out the data access layer in both and was writing a short summary of the pattern on our wiki at work.
It was whilst writing this summary that I realised I took a ...
Having a parent object Employee with a list of Address child objects:
class Employee
{
List<Address> addresses;
}
and a Repository method:
void Insert(Employee);
Should the code within this repository attempt to save the parent Employee as well as the child Address objects, or should separate repositories handle the parent and ...
Hey everyone,
I am working on a project using ASP.NET MVC, and repository model. I have repository classes, and services which consume these repository classes. My question is: Is it correct to return a IQueryable from my repository class and then use ".Where" and ".OrderBy" in a Service to generate a List? If yes, is it the best pract...
Hi,
I've been reading the book Pro ASP NET MVC Framework and I'm getting really confused with a lot of things. I've been trying to do some research but I'm finding that with so many different approaches and concepts being thrown at me, it's just making things worse.So I have a few questions:
I know MVC is supposed to split the functio...
So, I've read all the Q&A's here on SO regarding the subject of whether or not to expose IQueryable to the rest of your project or not (see here, and here), and I've ultimately decided that I don't want to expose IQueryable to anything but my Model. Because IQueryable is tied to certain persistence implementations I don't like the idea ...
Hi,
Just using this as an example...
Here are the columns in my UserProfile table:
ProfileID (Primary key)
UserID (Foreign key)
Address
PhoneNumber
now, when I want to add a new user to the database using LINQ to Entities, here is what I'm doing:
UserProfile profileToAdd;
profileToAdd.ProfileID = 0;
profileToAdd.Address =...
Hi,
I've built a repository and I want to run a bunch of tests on it to see what the functions return.
I'm using Visual Studio 2008 and I was wondering if there's any sandbox I can play around in (Whether in visual studio 2008 or not) or if I actually have to build a mock controller and view to test the repository?
Thanks,
Matt
...
I was trying to use ajax to retrieve data from a repository using a controller and I kept getting Internal Server Errors... I've whittled it down to the line:
private MyDBEntities _myDB = new MyDBEntities();
That's located in the repository, without that line I don't get the Internal Server Error.
The line is called after the Reposito...
Helo,
i have spent some time now to solve a problem for which i have no solution till now. I have a predefined very huge database, whose structure is fixed. I use the repository pattern to create a abstraction layer between service code and database logic. The problem is, that i need to apply some processing to the database object befor...
I thought I would rewrite this question (same iteration). The original was how to wrap a repository pattern around an EAV/CR database. I am trying a different approach.
Question: How could you code a data repository in a "factory" design pattern way? I have a fixed number of entities, but the attributes to these entities are fairly c...
What would a skeleton design look like for a repository able to support multiple database layers using ASP.NET MVC and C#? I want to see what a design would look like if I support both LINQ to SQL and NHibernate. How would I create my database object, and call a method on it in my BLL layer?
...
Hi there,
i am trying to tidy up my code, i have a number of projects that have References to my Service Layer i.e the DLL. What this means is that when i distribute a new service layer i have to upload a number of service layers which are generally the same..
Of course using the ADD Reference is very fast as its one assembly talking t...
What is a typical approach to using the repository pattern with .NET 1.1 (C#)?
I'm looking for something along the lines of this Stack Overflow question, except that in .NET 1.1, I don't have generics, so I'm just looking to see if it's possible (I'm sure it is), and how it's typically done.
...
I've found lots of examples of the repository pattern, all of which show the repository managing it's own connection lifecycle. I was wondering how people deal with a case where they want to share a single connection across multiple repositories?
The main reason I'm asking is because when I create a transaction, using TransactionScope,...
I have a pretty standard Repository pattern going, where repositories are injected into my MVC controller at construction. Repositories are initialized once per AppDomain and are shared by other controllers. Repositories access the database using NHibernate ISessions and ICriteria, but access is exposed using ListXYZ methods instead of a...
I want to use my own Model classes in a repository pattern. I don't want to be dependent on the classes that LINQ to SQL generates. Is that viable? How do I handle the Where (and other selections when its a Func<MyModel, bool> but LINQ to SQL wants a Func<LinqToSqlModel, bool>?
I've devised this, but I might be starting to over engineer...
I have a Solution with several projects in it, including two asp.net mvc projects that share a Repositories and Models that live in a external assembly (also in the same solution). Essentially...
Core/
-Repositories
-Models
Domestic.Web/
-Basic MVC Site, references the core project
International.Web/
-Basic MVC Site, references the ...
I'm developing a Domain Model based on the Repository Pattern and all of my Unit Tests as part of TDD are going against a Test Repository.
My question is: at what point do I create integration tests against the SQL version of the Repository?
My concern is that the code to access data from objects (Test Repository) will work fine. ...