Open sandboxFocus

Interface IProjectServiceFactory

A factory interface that creates IProjectService instances to be added to the project's service provider. Implement this interface and export it using ExportExtensionAttribute with ServiceFactory to provide custom services that can be consumed by aspects at compile time.

Namespace: Metalama.Framework.Engine.Services
Assembly: Metalama.Framework.Sdk.dll
Syntax
[CompileTime]
public interface IProjectServiceFactory
Examples

[assembly: ExportExtension(typeof(MyServiceFactory), ExtensionKinds.ServiceFactory)]

internal class MyServiceFactory : IProjectServiceFactory { public IEnumerable<IProjectService> CreateServices(in ProjectServiceProvider serviceProvider) { return [new MyCustomService(serviceProvider)]; } }

Methods

Name Description
CreateServices(in ProjectServiceProvider)

Creates the project services provided by this factory. The returned services will be added to the project's service provider and can be resolved by aspects using GetService<T>().

Extension Methods

See Also