.net MVC 3

Associate
Joined
12 May 2005
Posts
82
Location
Chester
Great thread! I wasn't aware of MVC before reading it and now I can't believe I've missed it. I've been going through the PluralSight videos on http://www.asp.net/mvc suggested by MrMark and I'm finding them very useful.

I am about to start work on a site that I'd love to develop using MVC 3 but it is going to be hosted on Fasthosts. The trouble is that after speaking to Fasthosts this morning they currently don't support asp.net 4 and can't give me a time scale for getting it implemented. I'd rather not use MVC 2. Does anyone have any suggestions as to a work around or, alternatively, would anyone recommend a host that does support asp.net 4?

Cheers
 
Caporegime
Joined
18 Oct 2002
Posts
29,491
Location
Back in East London
Personally, I think it a vital rule to keep the model in ASP.NET MVC absolutely and 100% separate from the rest of the app (aka Presentation Model). It should not be part of the domain as it will only lead to integration and maintenance problems because you've got one class being used at every level/layer of the application - this is bad news if, for example, you need to change the behaviour to suit the View, but the DB will crap out because it is incompatible etc.

Always, always translate the object when switching layers is my lesson from experience. :)

So on that note, don't apply any EF attributes to the view model. :p
 
Last edited:
Associate
Joined
15 Mar 2008
Posts
1,880
What's got me slightly confused is that in their example they have an Album Model with a Name Property.

So you could do something like Album.Name (just like they do in the Views) to access the name for that particular Album.

Now if I didn't use EF I would need to write my Controller in a manner to populate Album.Name, yet on the their Album the properties are blank so name looks like:

Code:
public string Name
{
get;
set;
}

So wouldn't I need something like:

Code:
private string _name

public string Name
{
get {return _name;}
set {_name = value;}
}

In the Album Model so that the Controller can actually populate the values? I guess EF is using some sort of voodoo magic to make their properties work?

Probably not going to write the Controllers without using EF but just interested to see if it would work or not :p
 
Soldato
OP
Joined
27 Mar 2003
Posts
2,708
So a quick update from me on this.

I am slowly working through the nerdDinner example at the moment but in the mean time I have started the database work for the project I think which will suit this.

I am assuming that if I just use the ado.net entity data model and place it in the models folder this does all the magic for me in talking back to the database and I don't have to write my own data access classes with service contracts to ensure the data is being presented in the correct way?

At least one good thing so far about this approach to web development for me is it is really making me think a lot harder about how data is related before actually coding anything on the screen.
 
Associate
Joined
2 Sep 2007
Posts
1,970
Guys do you think MVC will eventually replace web forms? I use the Devexpress controls and the only problem I have is they only have a limited number of controls available in MVC compared to their web form stuff.
 
Associate
Joined
11 Jul 2011
Posts
184
Guys do you think MVC will eventually replace web forms? I use the Devexpress controls and the only problem I have is they only have a limited number of controls available in MVC compared to their web form stuff.

From what I've seen on blogs and such, more and more people are moving to MVC

I think I read MVC is going to be the main focus from Microsoft. But Web Forms will still be continued to be updated etc. So it will still be around for a long time
 
Soldato
OP
Joined
27 Mar 2003
Posts
2,708
right cracking along on the nerdDinner demo now and as I said before this seems to much easier than web forms.

I know this is really simple compared to the stuff that I usually do at work but still it is amazing how easy it is and logical as well. I am certainly understanding concepts that I have struggled with in the past and seeing a big improvement in the way I am thinking about problems.

Seems that this is the month that a couple of mvc 3 books come out so I think I will get this one:

Pro ASP.NET MVC 3 Framework 3rd Edition as the previous versions seem to have been rated very highly.
 
Associate
Joined
11 Jul 2011
Posts
184
Pro ASP.NET MVC 3 Framework 3rd Edition as the previous versions seem to have been rated very highly.

Yeah I got MVC 2 of that books. Seems pretty good but after I got it MVC3 was released so couldn't be bothered going through it lol

The MVC 2 one seemed a bit akward timing IIRC. They purposely excluded a few things like Entity Framework as they didn't consider it ready at the time. Had Linq to Sql instead

I'm hoping MVC3 focuses more on EF and whatever other newer stuff, cause wasn't really interested in linq-to-sql
 
Associate
Joined
7 Nov 2005
Posts
728
Location
Southampton, UK
L2S does work, but it does have problems that aren't very well documented. We had one on my project eariler this yeah, I was so glad I'd forced through using the repository pattern. Swapping out for EF was trivial and works really well. Will be interested in using code first in EF4 soon.

Just a note though, MVC3 isn't bound to any one data access technology, it's a UI web technology only. Nothing to stop you using MVC3 with ADO.NET/NHibernate etc.
 
Back
Top Bottom