Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practices for project organization with ASP.NET MVC [closed]

Tags:

asp.net-mvc

I recently downloaded Rob Conery's excellent ASP.NET Storefront reference application and am finding it incredibly instructive. One question that comes to mind is where one should place the Model classes (and the Data classes upon which they depend). The MVC project template creates a Model folder. But it seems to me that I would be better served breaking the model out into a separate project assembly so that it can be re-used by other potential applications (e.g. management tools related to the website's application domain)?

I'm curious to get people's opinions.

like image 645
Howard Pinsley Avatar asked Nov 09 '08 01:11

Howard Pinsley


People also ask

Is ASP.NET MVC still relevant?

After a strong legacy of over two decades now, the net development services still remain relevant. As per a report by w3techs, ASP.NET is still used by 7.9% of all the websites whose server-side programming languages are known.

Under which situation we will prefer ASP.NET MVC project?

It's more sensible to use ASP.NET if you are already relying on 3rd party UI controls. The main advantage of using MVC is its separation of concerns. This allows for parallel development – different developers can work on Controller, View, and Model separately. This makes MVC ideal for team development.

How do you execute a method in ASP.NET MVC for every 24 hours?

You can create an external trigger that calls into your MVC action method every 24 hours. So you are executing your code every 24 hours. There are multiple ways and services to do that, i have used different services. Or you can create your own if you do not want to use third party.

What is the correct order for the lifecycle of an ASP.NET MVC page?

MVC actually defined in two life cycles, the application life cycle, and the request life cycle. The Starting point for every MVC application begins with routing. After that, the received request figures out and finds how it should be handled with the help of the URL Routing Module.


2 Answers

It really depends on the size of the project. There's no inherent value in having a separate "models" assembly, as you can unit test a Web Application project (including MVC projects).

like image 96
Brad Wilson Avatar answered Nov 09 '22 10:11

Brad Wilson


I would agree. Unless the application is only ever going to be the single web application, I would break it out into a separate project. Typically I will have a web application front end that uses one or more windows services to perform recurring, automated tasks (submitting charges, sending notifications, etc) and one or more console application tools to provision the application user base from our enterprise directory -- my apps are typically intranet apps that may apply only to subsets of our entire user population. Having the models (data layer) in a separate project allows me to easily share it with all other applications.

like image 30
tvanfosson Avatar answered Nov 09 '22 11:11

tvanfosson