dotnet / training-tutorials

Getting started tutorials for C# and ASP.NET

Home Page:http://dot.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Injecting Dependencies into Controllers

ardalis opened this issue · comments

ASPNET > Getting Started

  • Show how Controllers can follow Explicit Dependencies Principle and request their dependencies via their constructor.
  • Show how to configure services in ConfigureServices (going beyond what's in lesson 8).
  • Demonstrate how to use a configured service to perform some work for a view-based controller and for an API method.
  • Note that dependencies should be small and focused on only UI concerns. Business logic should go into other classes and should be injected. This makes both controllers and business classes easier to test (see next lesson).

Closed by #164