Hi All..
Application architecture is an interesting and regularly debated
topic among developers..
Everyone seems to have their own take on it based either purely on theory,
real world experiences, and as always, a mixture of both.
The application started out as a simple enough hosted ASP.NET MVC
application where users would visit a website, register, log in, and work
online.. Simple enough..
Recently there's been a change where the scope has creeped with "an eye for
the future", "maximise code re-use", etc.. Fair enough.. Great concept..
My dilemma now is what's the best architecture for this app now that we
will be (in the future -- when ever that gets here) accessing the system
from mobile devices, and probably not through the default ASP.NET MVC
interface that is currently being developed.
I've been looking around for a decent online example of an nTier
ASP.NETMVC application architecture, but most of the things I've found
are all
basically single tier where the author accesses the database via DAL
directly from controllers.
The app has morphed into the following Architecture...
------- ASP.NET MVC -------
| View
| + --> MVC Helpers
| |
| Model
| |
| Controller
| + --> Constants, Enums & Helpers.. (Separate DLL)
| + --> Session Repository (in MVC Project)
| + --> Domain Types (Models & ViewModels) (Separate DLL)
------- ------- ------- ------- -------
\/
| WCF Service Call...
/\
------- WCF Services SERVER -------
| WCF Services
| |
| Business Layer
| |
| DAL
| + --> Domain Types (Models & ViewModels) (Separate DLL) [.. this is
the same dll as referenced by the Controller above]
| + --> Constants, Enums & Helpers.. (Separate DLL) [.. this is the
same dll as referenced by the Controller above]
------- ------- ------- ------- -------
|
------- DATABASE Server -------
| Database
------- ------- ------- ------- -------
This architecture seems to be working fine for now and I know that i'm
probably going to have to change my WCF services to use a more RESTful
approach, or implement another more mobile friendly interface, to make it
easier for mobile connection, but that can happen down the track when i'm
ready for that part.
I'm also looking to use SQL CLR Types in the future so that I can be sure
that the data in reference tables (like say PhoneType, PencilType,
CarBrand, etc) mirror that exactly as in the Enums in the code. I've done
some preliminary investigations into this and it is feasible, but whether
it's worth it is another issue.
How are people designing their ASP.NET MVC app architecture out there in
the wild ??
I would love to hear/see your ideas/architecture..
Grant