ASP.NET MVC n-tier solution

Creating an n-tier solution for an ASP.NET MVC web app or web service.

It will have:

DAL – data access layer – uses Entity Framework to work with a SQL Server database

BLL – business logic layer – contains logic for the business/application; will be used by apps and services

ViewModels – shared view models that can be shared among separate web apps and web services that are located in this containing solution

Web app, and/or web service – user interface

 

Create a blank solution

File > New > Project

In the dialog, on the left-side navigator:

Installed > Templates > Other Project Types > Visual Studio Solutions

In the center panel, choose Blank Solution. Give it a suitable name.

Then, in Solution Explorer, right-click the solution object, and add a new item. Add a README.md plain-text file, which will briefly describe the solution and its projects in general terms.

 

Create the DAL (data access layer)

In Solution Explorer, right-click the solution object, and Add > New Project.

Look for Class Library. Choose a suitable name. “DAL” is a good name for a small to mid-size app or service.

Visual Studio will add the project. You can delete the “Class1.cs” source code file.

 

Update the project’s packages, and then add more packages

Using the NuGet package manager (console or graphical UI), update the project’s packages.

Then, add Entity Framework and AutoMapper.

 

 

 

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Advertisements
%d bloggers like this: