Appearance
Lamar as IoC Container
Part of Lamar's mission is to be a much more performant replacement for the venerable StructureMap IoC container library. As such, it supports much of the syntax of StructureMap's IContainer
interface and Registry DSL syntax for service registrations with the hopes that Lamar can be a near drop in replacement in many systems that use StructureMap today.
Because most new server side development in .Net today is targeting ASP.Net Core, Lamar was purposely designed and built to maximize compliance with the underlying IoC behavior assumed by ASP.Net Core. To reduce friction in Lamar usage, Lamar directly implements the core ASP.Net Core abstractions for dependency injection as shown in the samples below:
Lamar's Container
class subclasses another class in Lamar called Scope
that you probably won't interact with much directly:
cs
public class Container : Scope, IContainer, INestedContainer, IServiceScopeFactory, IServiceScope,
ISupportRequiredService
Scope
itself directly implements several other ASP.Net Core related interfaces:
cs
public class Scope : IServiceContext, IServiceProviderIsService
IServiceScope, ISupportRequiredService, IServiceScopeFactory are all ASP.Net Core DI abstractions.