Learn how to build ASP.NET MVC applications for long-term productivity and maintainability and be a more productive ASP.NET developer.
Overview
Syllabus
Introduction
- Improve the design of your ASP.NET MVC applications
- What you should know
- Using the exercise files
- Development environment setup
- Differentiating the ASP.NET MVC framework and design pattern
- Examining your applications to find opportunities for improvement
- Creating separate projects for application and business logic
- Enabling view compilation to detect errors at build time
- Reducing namespace references with global imports
- Customizing routes with attribute routing
- Reusing the same view for server-side and client-side rendering
- Better error logging with ELMAH
- Managing dependencies with dependency injection
- Using extension methods to remove magic strings
- Using extension methods to strongly type common actions
- Creating custom HTML helpers to reduce and reuse markup
- Using child actions to generate complex common markup
- Challenge: Use a child action to make a smarter HTML helper
- Solution: Use a child action to make a smarter HTML helper
- Creating a view model to contain view logic
- Populating a view model with data
- Updating a view to use a view model
- Reducing duplicate code with custom action filters
- Creating explicit contracts with request objects
- Moving business logic from a controller to a service
- Consuming a service from a controller
- Challenge: Creating a model validation action filter
- Solution: Creating a model validation action filter
- Understanding the Mediator pattern
- Installing and configuring MediatR
- Creating the handler
- Consuming the handler in a controller
- Understanding the feature folders approach
- Creating feature folders
- Enabling location of feature views
- Next steps
Taught by
Jess Chadwick