tags:

views:

78

answers:

3

I am learning ASP.NET MVC. I started reading "MVC in Action" and "Pro ASP.NET MVC Framework" books and noticed their text and code depend kinda heavily on some open source projects like MVCContrib, NHibernate, Castle Windsor.. etc. These are very good books with good sample projects however I need to learn raw ASP.NET MVC without cluttering my brain with other projects, even if it means I have to do things the harder ways. Plus the fact my projects could be maintained by coworkers with no knowledge about these open source project dependencies means I need to stick with pure Microsoft's offerings like Linq to SQL instead of NHibernate, no dependency injection module... etc.

Any good ASP.NET MVC books with full sample project which are just hard core MVC bits and no or minimum open source dependencies?

+2  A: 

I think Professional ASP.NET MVC 1.0 is close to what you are looking for.

J.W.
I started reading this book and it's easier to follow than the other two. I am still planning to read the other two books and they have some good valuable information. For example Linq in Action talks about another model layer whose sole purpose is for providing information for the UI view. (Automapper comes in).
Tony_Henrich
A: 

The thing is, part of the reason ASP.NET MVC was invented is to allow the developer to make use of tools and techniques like:

  1. Inversion of Control (IoC) containers
  2. Unit Testing
  3. Object-Relational Mapping (O/RM)

Now, the good news is that Microsoft has offerings for all three:

  1. The Unity Application Block is an IoC framework.
  2. MS Test is a unit testing framework.
  3. As you mentioned, Linq to SQL is an O/RM framework. There's also The ADO.NET Entity Framework, which is a bit more advanced.

I also would recommend Pro ASP.NET MVC Framework. It uses Castle Windsor for IoC, but Unity works more or less the same way. It also uses NUnit instead of MSTest, but they are likewise nearly identical.

If you want to learn ASP.NET MVC, then you'll definitely want to incorporate the stuff listed above because that's basically the whole point of the MVC framework. If you don't want to learn these things, then you'll be happier sticking with WebForms.

Josh Kodroff
Nicholas Murray
It's not about not learning them. it's about concentrating on the basics first and incorporating extensions later. I don't want to be bogged down with multiple different frameworks on day one.
Tony_Henrich
Maybe you'll want to reverse your approach then: try learning about unit testing, IoC, and OR/M first, then come to ASP.NET MVC and see how it ties it all together by making your UI testable.
Josh Kodroff
+1  A: 

Just a thought but you could very easily ignore the open source dependencies in Pro ASP.NET MVC Framework. Off the top of my head all you would have to is:

  • Hard code your connection string in your repositories or get the value from the connectionStrings node in web.config
  • Give your controller constructor a concrete implementation instead of an interface.

Those would would relieve the dependency on Castle Windsor. It would add some steps to unit testing but still very doable.

  • Use either ViewData, inline logic (not recommended), RenderPartials, or HtmlHelpers to do what the MVCFutures RenderAction does in the book. (Although this is a dependency in the book MVC version 2 will have native support for RenderAction)

You could also use the native unit testing environment of VS2008 instead of nUnit.

And that's about it as far as I remember from that book. A couple of very minor tweaks (even more minor if you're using MVC version 2) and your free from dependencies.

DM