liveBook · Manning

Lamar.Microsoft.DependencyInjection

As explained in ASP.NET Core in Action, 3e

Lamar.Microsoft.DependencyInjection is a .NET integration package that enables an ASP.NET Core application to use Lamar as its service container.

Lamar.Microsoft.DependencyInjection connects an ASP.NET Core application to Lamar as its dependency-injection container. Setup follows three steps: install the NuGet package, call UseLamar() on WebApplicationBuilder.Host, and register application services. section 31.3

A minimal integration workflow is:

  • Install Lamar.Microsoft.DependencyInjection with dotnet add package or a PackageReference. section 31.3
  • Call builder.Host.UseLamar() in Program.cs. section 31.3
  • Configure the supplied ServiceRegistry, which supports built-in registrations such as AddControllers() and AddAuthorization(). section 31.3
  • Use AddControllersAsServices() when MVC controller dependencies are registered with Lamar, so Lamar builds the controllers. section 31.3

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains package installation, host configuration, service registration, conventions, scanning, and an MVC controller caveat.
Examples
Uses Program.cs configuration with UseLamar(), AddAuthorization(), AddControllersAsServices(), and default-convention assembly scanning.
What it assumes
Assumes a basic ASP.NET Core application and introduces the minimum package, host, and service-registration steps.
What you can do after
Operate/configure an ASP.NET Core application with Lamar as its service container.
How it connects
Connects dependency injection with ASP.NET Core, WebApplicationBuilder, ServiceRegistry, MVC controllers, and assembly scanning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.