views:

119

answers:

4

We are starting up a new project in ASP.Net MVC, could you please suggest which is the best?

I have added this question as to know what are the different options.

+4  A: 

See S#arp Architecture.

http://www.sharparchitecture.net/

This is a project (template for Visual Studio) with a serie of patterns and best pratices.

This project follow the rules of Domain-driven design.

[]´s

Juliano Oliveira
+1, not a bad starting point.Think @Ravia needs the basics first though.
griegs
I started using without any knowledge of ASP.NET MVC, NHibernate, and little jQuery (though good OOP, ASP.NET and databases). In my opinion S#arp is very good at giving anyone a quick start, since it eliminates almost all the infrastructure issues, and one can start trying things right away - i.e. a practical approach to learning.
queen3
A: 

If you come from a WebForms environment then you're probably comfortable with ViewState etc.

My advice is to get out of that and start thinking of REST and writing RESTful applications.

Life becomes a whole lot easier after that.

Hope this is what you were asking.

griegs
A: 

Ravia, Instead of posting general questions why don't you take the time to read up on or watch a good presentation on MVC, check out Scott Guthries intro to MVC, it's long but worth it. You'll have an idea what you're getting into then

Israfel
+1  A: 

It is often recommended to use the MVVM Pattern, that means having ViewModels. Basically for every View, there is a simple Model class that holds all the data that goes into the View. This is done to avoid passing "too much" (complex business objects) into the Model and to easily compose the ViewModel.

For example, if you need to display some data from a Business Class called "User" (i.e. the Name) and some Data from a List of Orders (i.e. Order Numbers), you could create a Model class that only holds the string username and an IEnumerable of string with just the order numbers. This also allows to simplify the class, for example instead of having to write "User.CurrentAddress.ZipCode", you could just have a string ZipCode, which reduces nesting.

The main reason for this viewmodel is that it's easy to change. Say you also want to display the last item the user ordered - Fine, just add a new Property to the ViewModel. If you passed the User class directly to the View, you may have to do something like User.Orders.Last().Items.Last() which is ugly and could possibly have huge performance implications - and it assumes that the User class has access to the orders! If you all of a sudden need to add a field from another unrelated class, you have to do some big refactoring.

Michael Stum
And here's a simple reference application using the view model approach in a number of different UI platforms: http://polymorphicpodcast.com/vmworkshop/
rohancragg