MODUL AR
APPLICATION
M O D U L A R S E PA R AT I O N T E C H N I Q U E
BENEFITS OF THIS APPROACH
• Each module may be developed and deployed separately.
• Helps in building different version of the product like basic, professional, premium etc.
• Build separate installers with the required features for each different version.
• Able to develop application modules independently.
• Larger modules can be easily maintained separately.
• Each module can be plug or unplug any time.
• Single session can be maintained in all the modules though the different application modules.
PREREQUISITES OF CONCEPT
• Application should be developed in MVC
• Visual studio 2012 or above.
• Visual studio 2017 is recommended
CONCEPT OF AREAS
• The structure of a complex [Link] MVC application can be very easily maintained using AREAS.
• The concept of this is to allow us to breakdown a large complex application into a several small
sections called AREAS.
• An MVC application can have any number of AREAS.
• Physically, AREAS are put under separate folders.
• AREAS are useful in managing big web applications.
• A web application project can also use AREAS from different projects.
• Using AREAS, multiple developers can work on the same web application project.
• These areas can have their own set of:
1. Models
2. Views
3. Controllers
4. Routes
HOW TO CREATE MODULAR
APPLICATION
• Here we will create a web application that contains the following modules:
1. Incident Management
2. Brand Hygiene
3. Parking Assistant
4. Asset Management
STEP 1
Open Visual Studio and create an
[Link] MVC project as follows.
Give it a meaningful name.
Once it is created, your solution
should look like this
STEP 2
Right-click on the ‘Controllers’
folder and select “Add ->
Controller”. Name
it HomeController, and select
“Empty MVC Controller” for the
template
STEP 2
Right-click on the Index method of
the controller and select “Add
View”. Using defaults, create the
Index view for HomeController to
form the landing page for the
application
STEP 4
Now edit the highlighted section
in _Layout.cshtml (under the
Views\Shared folder) in order to
create menu items pointing to the
desired modules
Run the application
Now we will focus on creating separate
modules for our application and then plug
them into the main one.
STEP 5
Right-click on the main application
project title in the Solution
Explorer and select “Add->Area”
from the context menu. This will
create a basic folder structure for
the Area framework. Specify
“IncidentManagement” as Area
name and click “Add”.
STEP 6
Take a backup of
the IncidentManagementAreaReg
[Link] file. This file will be
needed later on when we add the
Incident Management module to the
solution as a separate project.
Now remove the IncidentManagement
subfolder from the Areas folder,
keeping the Areas folder in place.
STEP 7
Next add the new pluggable module
for “Incident Management”.
Right-click on the solution and
choose “Add-> New Project”.
Name to project
‘IncidentManagement’
Set Location as
“…\ModularApplication\Modular
Application\Areas\”
A new project should be created in
the Areas folder (previously created).
As we saved new project
IncidentMangement under the
Areas folder, it appears as hidden
folder under the
ModularApplication/Areas folder in
the Solution Explorer:
STEP 8
Adjust the
ModularApplicatiion’s [Link]
file to properly add the correct
namespace overload to the
[Link]() method
STEP 9
Set the output directory
of IncidentManagement project
to ..\..\bin\ so that it’s compiled
DLLs are placed in the bin
directory of the
ModularApplication application.
Setting related to connection
strings, authentication, membership,
role manager, profile, and session
state are going to be placed in the
[Link] of your root directory.
So remove all these section from
the IncidentManagement’s
[Link].
STEP 10
Create the IncidentHome
controller in the
IncidentManagement project.
· Create an Index view and place
the content “Welcome to Incident
Management Module” in its header.
STEP 11
Now add
[Link]
file (Backup file from step 6) to the root
directory of the IncidentManagement
project and add the correct namespace
overload to the [Link]()
method
STEP 12
Now build the solution and check
the ModularApplication/bin folder
and you will have the compiled
DLLs for the Sale module there
Now run the application
You can follow the same steps and
create other larger modules
separately and plug them in to
your application.
THANK YOU
HAPPY CODING