Unity extension to integrate with Microsoft.Extensions.Logging.
- Reference the Unity.Microsoft.Logging package from NuGet.
Install-Package Unity.Microsoft.Logging
ILoggerFactory loggerFactory = new LoggerFactory();
loggerFactory.AddProvider(new ConsoleLoggerProvider((text, logLevel) => logLevel >= LogLevel.Debug, false));
var container = new UnityContainer();
container.AddExtension(new LoggingExtension(loggerFactory));
// Register few types
container.RegisterType<IService, Service>();
var service = container.Resolve<IService>();
For more information see this example
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct
See the Contributing guide for more information.
Unity Container is a .NET Foundation project