Provides access to project-scoped services. A wrapper around ServiceProvider<TBase> for IProjectService.
Namespace: Metalama.Framework.Engine.Services
Assembly: Metalama.Framework.Sdk.dll
Syntax
public readonly struct ProjectServiceProviderRemarks
Project services are scoped to a specific compilation or project. This provider also provides access to global services through the Global property.
This type is immutable. Methods like WithService(IProjectService, bool) and WithServices(IEnumerable<IProjectService>) return a new instance instead of modifying the current one.
Properties
| Name | Description |
|---|---|
| Empty | Gets an empty ProjectServiceProvider instance. |
| Global | Gets the GlobalServiceProvider that provides access to global services. |
| Underlying | Gets the underlying ServiceProvider<TBase> for IProjectService. |
Methods
| Name | Description |
|---|---|
| GetRequiredService<T>() | Gets a required service from the provider. |
| GetService<T>() | Gets an optional service from the provider. |
| ToString() | |
| WithService(IProjectService, bool) | Returns a new ProjectServiceProvider with an additional service. |
| WithServices(params IProjectService[]) | Returns a new ServiceProvider<TBase> with additional services. |
| WithServices(IEnumerable<IProjectService>) | Returns a new ServiceProvider<TBase> with additional services. |
Operators
| Name | Description |
|---|---|
| implicit operator GlobalServiceProvider(in ProjectServiceProvider) | Implicitly converts a ProjectServiceProvider to a GlobalServiceProvider. |
| implicit operator ServiceProvider<IProjectService>(in ProjectServiceProvider) | Implicitly converts a ProjectServiceProvider to a ServiceProvider<TBase>. |
| implicit operator ProjectServiceProvider(ServiceProvider<IProjectService>) | Implicitly converts a ServiceProvider<TBase> to a ProjectServiceProvider. |