public void ConfigureServices(IServiceCollection services) { services.AddTransient <IService, Service>(); //services.AddTransient<ICalculator, Calculator>(); services.AddTransient(serviceProvider => { var service = serviceProvider.GetService <IService>(); var decorator = LoggingDecorator <ICalculator> .Create(new Calculator(service)); return(decorator); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
public EventController(IHostingEnvironment appEnvironment) { _appEnvironment = appEnvironment; repository = LoggingDecorator <IEventRepository> .Create(new EventRepository()); }