In our MVC app, we’d like a way to keep track of what’s happening when launching the application. The way we do this is by adding support for logging. The video shows us how we can do that in the Startup file. Next, in order to add the interfaces and services required we go to ConfigureServices and add support with services.AddLogging(). The video then shows changes we make in the controller and executes the code as a demo. Also learn why logging is important.
- [Instructor] Let's talk about logging.…Let's say in our NBC app we'd like a way…to keep track of what's happening…when the application is launching.…And the way we can do this is by adding…support for logging and we can do that in the startup file.…So let's open up the startup file…and in order to add the interfaces and…services that's going to be required for logging,…what we want to do is add services.addlogging…within the configure services method.…So let's scroll on down to configure services…and simply add services, add logging.…
Next we need to go to the configure method.…And over here we already have…an iLogger factory being passed in.…Which is cool, because from this factory…we can add certain types of logging.…The type of logging we use should…vary if a development versus production.…So let's say in this case for development,…we'll set the log to provide general information…and for any non-development environment,…it will provide error-related information.…So the way we're going to do this is by…simply adding in the condition for is development,…
- Entity Framework (EF) overview
- Uses for EF
- Installing EF
- Creating entities
- Creating the DbContext
- Performing migrations
- Creating an MVC application
- Installing EF packages
- Reverse engineering the model
- Performing context and dependency injection
- Creating the controller and the view
- Using SqlServerTypeMapper
Skill Level Intermediate
Q: This course was updated on 06/23/2017. What changed?
A: The following topics were updated: using the exercise files; Mac install prerequisites; Entity Framework on Mac, part 1; and Entity Framework on Mac, part 2.