Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've already formulated my problem in another site but I'm asking here as well since I really like to receive a response regarding my questions.

http://stackoverflow.com/questions/13672775/repository-and-unit-of-work-usage-in-web-shop-project[^]

I'm creating a web shop using MVC4 razor syntax, repository and Unit of work. At least that is what I'm trying to do.

I still have some doubts about the usage of repository and Unit of work and I'm hoping I can get some clarity here.

I've found two good tutorials regarding it.

The first one: http://www.tugberkugurlu.com/archive/generic-repository-pattern-entity-framework-asp-net-mvc-and-unit-testing-triangle

The second one: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application

Now, I've read both and I'm a bit confused. In the first one, the GenericRepository class is abstract and has TC and T. TC being a DbContext object and T being a class. In the second tut, only a class is needed.

Why these different approaches? Is it because the second tutorial also uses Unit Of Work? Is one better than the other or is Unit Of Work not really necessarily?

In my project I have 20 tables, does this mean I have to create 20 repositories if some of those are used to create a multi-language site?

Finally, Do these repositories belong in the Model folder or in a seperate one like "Data Access Layer"? If it's the later, Does anything ever belong on the Model folder using repositories?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900