- 343 students
- 46 lessons
- 0 quizzes
- 16 week duration
1. Getting Started
- 1.1 Introduction to the course
- 1.2 What we will build
- 1.3 What is ASP.NET Core and Why to use it
- 1.4 Install Visual Studio 2017
- 1.5 Install SQL Server 2017 and SSMS
- 1.6 Create Basic MVC Project in ASP.NET and ASP.NET Core
- 1.7 Compare Folder Structure (ASP.NET and ASP.NET Core)
- 1.8 Get Ready for your first challenge
2. Working with Data
- 2.1 Introduction and understand entity framework
- 2.2 Create Project and add domain classes
- 2.3 Add DbContext
- 2.4 Add Connection String
- 2.5 Configure DbContext as Service and add DbSet to Application DbContext
- 2.6 Add Migration and Update Database
- 2.7 Verify tables in Database using SSMS
- Exercise and Next challenge
- 2.8 Apply Constraints and rollback previous database migration
3. Understanding MVC Fundamentals
4. Implementing CRUD Operations
- 4.1 Make – Bootstrap migration and create list page for makes of vehicle
- 4.2 Make – Create operation to add new Makes
- 4.3 Make – Delete operation to delete makes
- 4.4 Make – Edit operation to Edit makes and add beautiful icons on buttons
- 4.5 Model – Implement CRUD using ViewModel – Part-1
- 4.6 Model – Implement CRUD Part-2 and Refactor existing code
- 4.7 Extension methods and using it to refactor existing method
6. Deployment on Azure
7. Completing Application
- Adding Bike
- Upload Bike Image and implement Delete Bike Functionality
- Server side and client side data validation
- Implement Cascading Drop down List using WebAPI and Ajax
- Decouple domain and service layer
- Using Automapper to map Service and domain layer objects
- Implement Pagination on Bike Index Page
- Filtering and Sorting a Bike
- Edit Bike
- Bike search on home page
7. Some advance concepts
1.7 Compare Folder Structure (ASP.NET and ASP.NET Core)
In our previous lesson we have created two projects, one in ASP.NET and another one in ASP.NET Core.
So let’s open both the projects side by side to compare the the folder structure of both the applications.
You can see there are many more folders available in root of older ASP.NET version, while there are very few folders available in root of ASP.NET Core.
Let’s have a look at the default files and folders created by Visual Studio in older ASP.NET project and understand the importance of those. Also we will understand what has changed in ASP.NET Core corresponding to each file and folder.
New projects often begin with an empty App_Data folder. this is where you can place database files, this folder no longer created in ASP.NET Core by default. But if needed, you can create the same manually.
App_Start (This folder is no longer available in ASP.NET Core
This is the folder which contains various classes which are called when our application starts. So let’s understand the purpose of each file in this folder.
It allows programmers to specify the CSS and JS files which you want to add to bundling.
If you are not aware of, what the bundling is, I would like to tell you that Bundling is a feature, that was introduced in ASP.NET 4.5 ,that helps to boos the performance of your application by combining or bundling multiple files, into a single minified file. Fewer files means fewer HTTP requests, and that can improve the performance your web application.
ASP.NET Core Changes
So where is this file in ASP.NET?
Unfortunately Bundling and Minification no longer exists in MVC Core by default. But don’t worry, you can do that manually, if needed.
I am providing the link to the document to know how you can do that in ASP.NET Core below.
ASP.NET MVC Filters are used to inject extra logic at the different levels of MVC Framework request processing. Filters provide a way to add filters in request pipeline, so that all the requests pass through with those filters.
The ASP.NET MVC Framework supports various different types of filters i.e. Authentication, Authorisation, Action, Results and Exceptions
Each filter allows you to introduce custom logic at different points during request processing.
This filter file no longer exists in ASP.NET core and all of these filtering can be added using ConfigureServices method available in Startup Class now.
Let’s look at RouteConfig class, this is used for routing.
Routing functionality is responsible for mapping an incoming request to a route handler. Routes are defined in the app and configured when the app starts We will understand it in depth later in this course.
In this section it is sufficient to know that ASP.NET MVC routing is used to map the URL coming through browser to the specific controller class and action. If that controller and action is matched, it will be executed and page will be rendered.
If it is not matched, 404 error is returned.
In older approach there was an issue that if you had to exclude any of these public folders, you had to blacklist that folder from your application.
But now ASP.NET core took a different approach, where Application root is blacklisted and wwwroot is whitelisted. With this approach the chances of something private, accidently exposed outside, is reduced. This is really a nice separation
So these are the folders which contains public assets are now moved to the wwwroot. Let’s understand what each folder contains.
It contains css, images or any other client side assets, by default visual studio place few files i.e. bootstrap.css and site.css already in this folder.
this folder exists is because, Bootstrap is included by default in MVC. And that’s probably also the reason that the naming conventions of this folder, does not match with the rest of the solution, you can see F is not capitalized.
This is the icon, which is displayed on the browser tabs, you can see the small icons, that is displayed using favicon files only.
Controllers are responsible for controlling the flow of your application. When you request a page on browser in MVC application, a controller is responsible for returning the response to that request.
All of our domain models will be placed here. The model represents the data, and does nothing else.
And finally we have view folder which contains the classes responsible to create the user interface of your web application. And interestingly, views folder includes separate folder for each controller with exact name without suffixing controller in folder name.
Let’s expand the controller folder and see, we do have exactly the folders with same name corresponding to the controller name.
In addition to these folders, we do have shared folder, which contains the views that will be shared among different controllers, for example, layout file
Additionally, MVC project also includes various configuration files
This is one of the traditional file which is there in asp.net since long time, this file allow us to write the codes which can be executed in response of various application level events, such as application_start, session_start and sesstion_end etc. From ASP.NET Core Global.asax file has been removed completely and introduced Startup.cs as a replacement of Global.asax
This file is managed by NuGet manager, in order to maintain the list of packages, referenced by the project. This allows NuGet to easily restore the project’s dependencies when the project to be transported to a different machine, such as a build server, staging and testing machine. NuGet package manager automatically download the required library from the central repository.
Let’s take a look at this file, and you can see it contains the reference to the various library with their version names.
In dotnet core this file does not exists, packages are declared inside of the csproj file. You can open that file by right clicking on project …. And edit <your proejct name.csproj>. You can see PackageReference are there in ItemGrouop section.
And finally we do have web.config file, which is an xml file, which is used for application level configuration, most of time you work with only two section in this file.
One is connection string, which is used to define the database connection of your application
2nd one is AppSettings, which is where we define our Application settings in key value pair.
ASP.NET core have introduced a new file appsetting.json as replacement of this for application setting configuration.
And web.config file is automatically generated when you publish the application.
Followings are the two additional files which are available in ASP.NET core, we will understand both of those.
In ASP.NET 5, Startup.cs file has introduced and as mentioned earlier, this file is the replacement of Global.asax. From ASP.NET Core, Global.asax file has been removed completely.
If you have worked on console application in C#, this file looks familiar to you. This is the entry point of your application and now ASP.NET Core application starts as a console application.
The main method is responsible to create your webhost. It invokes the WebHost.CreateDefaultBuilder method which defines the web server and startup class.
Build and Run methods build the IWebHost object that hosts the application and begins listening for HTTP requests.
So our development environment is ready and you are now familiar with the files and folder structure of ASP.NET core. Next we are going to revisit our Bikers project requirement and get ready for the first challenge.