Please help me with publishing my first Asp.Net MVC project - I'm learning as I go

semaphore

Honorary Master
Joined
Nov 13, 2007
Messages
15,194
I'm not sure if you realise that MVC is a pattern, not a MS invention.

The ASP.NET implementations of the MVC pattern do have a lot to be desired, not least of which is the way that you are encouraged to work within the "MS way" and if you do not it gets pretty complex (other people's MVC work?)

Bit the MVC pattern (and it's relatives) really help with separating your system into simple, single-purpose pieces of code, which in turn makes your application easier to work with.

What leaves a lot to be desired?

What gets complex?
 

scudsucker

Executive Member
Joined
Oct 16, 2006
Messages
9,024
What leaves a lot to be desired?

What gets complex?
It's been a while now since I wrote an MVC api/site in .NET, so my memory is a little poor.

Basically all the building blocks are there, but you kind of have to follow the MS prescribed system. Filters and interceptors are done in one way and one way only. (Unless you want to fight). Routing is done in only one (or two) ways. .. unless you want to fight.

I'm not unhappy with the .NET MVC environment but when I was using it I needed non-standard, not "out of the box" stuff and I found I needed to do a lot of replication of existing systems because my needs were narrowly out of the MS defined box.

That said, at the time, I was working on "experimental" stuff for my company so if I reached boundaries in that little area it doesn't necessarily reflect badly on MS as a whole.
 

semaphore

Honorary Master
Joined
Nov 13, 2007
Messages
15,194
It's been a while now since I wrote an MVC api/site in .NET, so my memory is a little poor.

Basically all the building blocks are there, but you kind of have to follow the MS prescribed system. Filters and interceptors are done in one way and one way only. (Unless you want to fight). Routing is done in only one (or two) ways. .. unless you want to fight.

I'm not unhappy with the .NET MVC environment but when I was using it I needed non-standard, not "out of the box" stuff and I found I needed to do a lot of replication of existing systems because my needs were narrowly out of the MS defined box.

That said, at the time, I was working on "experimental" stuff for my company so if I reached boundaries in that little area it doesn't necessarily reflect badly on MS as a whole.

Interesting, find a sample of the complex stuff one day. I'd be interested to see if you were just over engineering it, or if it was indeed something out of the bounds of the framework.
 

scudsucker

Executive Member
Joined
Oct 16, 2006
Messages
9,024
I'd be interested to see if you were just over engineering it, or if it was indeed something out of the bounds of the framework.

I'm a developer. We over-engineer as a lifestyle!

There's nothing out of the bounds of the framework. But there are things that a framework may not necessarily cater for.

I've left the company for whom I tried to perform miracles with .NET MVC so I can't even offer examples of anonymised code. I don't have proof: all I can say is that in my opinion, deviating from the MS prescripts of how MVC should be done, is done at your peril.

(I know that's a pretty weak argument; I could make the same one for PHP - and THAT is embarrassing)
 

foozball3000

Executive Member
Joined
Oct 28, 2008
Messages
5,827
Then perhaps you're prototyping your app wrong, why not use something you're familiar with and then architect it properly once you know its viable.

[)roi(];19170834 said:
Good advice... starting out it's always best to focus on getting the app to work... Refining, good design, etc. can be part of refactoring.

It may not be the most optimal way, but the way that works is what matters, isn't it?
And it does work. Got my feet wet in a completely alien environment in less than a month, and have a half decent working app. Win win. Incentive goes a long way when you have to learn something new.

Except for the hosting part, which is a bit of a hasstle. But that would have been an issue either way going forward. I'm amazed that Afrihost and WebAfrica isn't running on DOS.
 

gkm

Expert Member
Joined
May 10, 2005
Messages
1,519

semaphore

Honorary Master
Joined
Nov 13, 2007
Messages
15,194
Just use Azure for .NET related stuff. You wont even reach your free tier.
 

Spacerat

Expert Member
Joined
Jul 29, 2015
Messages
1,328
That's not the problem. While I do think it unnecessarily complicates simple development, the real downfall is working with other people's MVC work.

As others have said, MVC is just a pattern.

Your domain logic, rules etc should NOT be dependent on MVC. I.e. no DB access/domain logic should go into the controller. The MVC framework's ONLY responsibility is to marshal the HTTP requests & responses and authentication/authorisation. Once in the controller, you pass the data over to your domain code using DI. Your domain code should be able to run and be tested completely independent from MVC, i.e. even in a console app.
 

DA-LION-619

Honorary Master
Joined
Aug 22, 2009
Messages
13,777
As others have said, MVC is just a pattern.

Your domain logic, rules etc should NOT be dependent on MVC. I.e. no DB access/domain logic should go into the controller. The MVC framework's ONLY responsibility is to marshal the HTTP requests & responses and authentication/authorisation. Once in the controller, you pass the data over to your domain code using DI. Your domain code should be able to run and be tested completely independent from MVC, i.e. even in a console app.

Lies everyone knows MVC means having 3 folders for Models, Views and Controllers
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
Adding onto what @spacerat said:

Here's a typical MVC model and its set of interactions:
Screen Shot 2017-02-16 at 10.49.23 AM.png
The basic principle is that a well designed MVC pattern can typically swop in/out both the view and the model for compliant alternatives, for example:
  • A view for iOS devices
  • A view for Android devices
  • A view for desktop
  • etc...

Typical Patterns:
As mentioned by @spacerat; Dependency Injection is a common technique to accommodate a plugin / modular design, and the Delegation pattern is common for the events (the arrows in the diagram).

Caveats:
A sarcastic nickname for MVC is "Massive View Controller", which refers to the often inevitable difficultly of deciding where to put things; and in the absence of solution, it usually ends up in a ever growing Controller. Here's an article that's discusses solutions to avoid a Massive Controller; if you excuse the Objective-C parts; the concepts introduced in this article are applicable to many MVC implementations.
 
Last edited:

foozball3000

Executive Member
Joined
Oct 28, 2008
Messages
5,827
Hi, it seems that a DB with my free Azure Account isn't possible?
All the options I'm looking at seems like paid options?
 

foozball3000

Executive Member
Joined
Oct 28, 2008
Messages
5,827
No, I am hosting an Azure Sql DB on a free tier.

Okay, I've found that selection. Somehow I missed that :)

Have you tried to RTFM?

Hahaha, I'm assuming that's "read the ... manual"
Yes, I did, briefly.

UPDATE:

Site is live and working!! It is shockingly simple with Azure. :D

After all this trouble, I nearly want to cry from relief. Perhaps a strong worded email is in order to WebAfrica.

Unfortuanately I can't show the site yet, it's not ready for the public. Busy testing the business logic and things first before the site is made user friendly.

BIG THANKS to all of you! I'd probably have lost hope without you lot.
 
Last edited:
Top