Castle Ghosts of Scotland



Apache Solr Delete Query

Just another post for reference.  This is the Apache Solr delete query that actually works. http://<server>:<port>/solr/<core.....

IIS Manager .NET Roles

So just had a break through with ASP.NET that has made my day and wanted to share with everyone.It makes complete sense now to manage the .NET members.....
Page 1 of 2
Previous Next 

My Thoughts On ASP.NET WebForms vs MVC

Hello everyone,

So for the past wee while I've been spending time learning ASP.NET MVC.  It's certainly a new learning curve if you come from a WebForms background.  Particuarly a learning curve because the database focus is based around the Entity Framework.  I also got my mind around how the model works along with the controller classes.

As always learning something new can take time and be a bit exhausting but it's not been a waste of time so I wanted to share my experience of it here.  Different people have different opinions and I think it just depends what framework you feel most comfortable using.  A lot of emphasis has been on the Entity Framework.  Also the majority of examples on the web are in C# so it's very useful if you at least pick up the C# syntax so you can translate it to VB, however you prefer to work.

When I first looked at ASP.NET MVC with the new Razor web pages syntax, I was very excited because it looked really easy.  Then I got into form validation and that is something completely different all together.  There's two ways you can use validation in MVC.  One is the use of data annotations which is in the System.ComponentModel.DataAnnotations namespace - the model allows you to set the required validator for your text box in the class, which looks easy and should save time.  The problem comes however when you have different model types for your views.  You can use data annotations when you have a create or edit view, but not with a list view.  The solution in list view is to validate forms using the ModelState. 

Another thing about ASP.NET MVC is the controllers.  Experienced MVC developers will probably have their methods for using controllers with sub folders.  That is when I really started missing WebForms.  MVC just seems too complicated in comparison to WebForms.  Two of my favourite things about WebForms are the CodeBehind feature to avoid messy spagetthi code, and the fact that form validation is built in, works the same way for everything and is super easy. 

After reading a lot of web posts on WebForms vs MVC, I've come to the conclusion that it's down to personal choice.  It's not been a waste of time learning MVC and if I ever use it commercially one day I'll at least know the basics.  WebForms just seems like less hassle.  I am choosing to go with WebForms. 

Just my thoughts on it all.

Kind Regards


Please add a comment using the form below. Your email address will not be published. Thank you.