List of Best ASP.NET Core Books
Understanding the lifetime of the services created using the Dependency injection is very essential, before starting to using them. Creating services without understanding the difference between Transient, Singleton & Scoped lifetime can result in application behaving erratically. When a service requests another service via DI, knowing whether it receives the new instance or an already created instance is very important. Hence correctly specifying the lifetime while registering the service are utmost important.
Dependency injection has now become the first class citizen in ASP.NET Core. It helps us to build loosely coupled, easily readable and maintainable code. In this tutorial, we will learn the basics of the dependency injection by building a simple application.
The ASP.NET provides validation related tag helpers which display the validation messages to the user. We learned how server-side model validation works in the previous tutorial. The Model binder binds and validates the data received over the HTTP Request. It then creates the ModelState object, which contains the validation messages generated by the Model Binder. The Validation Tag helpers generate the HTML element to display these messages in the view.