views:

626

answers:

3

I'm having trouble finding examples of ASP.NET MVC solutions that use EF4 in their repository while adhering to SoC.

Can anyone provide me with references to examples (open source, books, tutorials, articles, etc.) that demonstrate the following?

  • ASP.NET MVC 2
  • Entity Frameworks 4
  • Repository Pattern
  • Separation of Concerns (i.e. BL does not explicitly reference anything)

In addition to the core technologies/patterns/principals above, I would really appreciate it if the examples also covered these topics so I could see how they might change with EF4:

  • Multi-project solutions
  • Dependency Injection (Windsor)
  • Unit Tests
  • Unit of Work

One example covering the use of context interfaces is on Stack Overflow but I'm seeking something a little more comprehensive if it exists.

Many thanks!

+3  A: 

This is a very comprehensive article on Testability and the Entity Framework 4. It also discusses the repository pattern in great detail and even compares differences in different possible implementations of the Repository pattern (including Unit of Work). it also covers depenency injection. it does all this in the context of an MVC 2 app.

Steve Michelotti
+2  A: 

Try watching the video at http://tekpub.com/production/starter and downloading the sample (link is available in the same page). It uses Ninject to IoC byt may help you with some of the topics you posted anyway.

Gmoliv
Their approach is certainly interesting. I'll have to explore it further - thanks!
Mayo
+2  A: 

I came across the Microsoft - Domain Oriented N-Layered .NET 4.0 App Sample while looking for DDD examples:

This project implements a very simple business scenario, but it is quite end to end complete regarding DDD N-Layered Architecture style , showing DDD design patterns implementation (Repository, UoW, Entity, Aggregate, Value-Object, etc.), using .NET 4.0 'technology wave' (EF 4.0, WCF 4.0, etc.) and several Archetypes (we'll be growing to many different clients, starting from WPF 4.0 , Silverlight 4.0 , and going to ASP.NET MVC , OBA , Windows Phone during the next future).

I haven't had a chance to look through the code in depth, but it looks like a very comprehensive example hitting on all the points you list, although it looks like they use Unity for IoC.

Hope this helps.

adrift