// Registering a decorator for an existing IService implementation container.RegisterSingletonIn the first example, a decorator is registered for an existing implementation of IService. The decorator will wrap the existing implementation and add functionality to it. In the second example, a decorator is registered for an open generic implementation of IRepository. This means that the decorator will apply to any implementation of IRepository with any type argument. In the third example, a decorator is registered for an implementation of IService, but only if the implementation type is ServiceImpl. This allows for more fine-grained control over when the decorator is applied. These examples use the SimpleInjector.Container package library.(); container.RegisterDecorator (); // Registering a decorator for an open generic implementation container.Register(typeof(IRepository<>), typeof(Repository<>)); container.RegisterDecorator(typeof(IRepository<>), typeof(RepositoryDecorator<>)); // Registering a decorator with conditionals container.Register (); container.RegisterDecorator (context => context.ImplementationType == typeof(ServiceImpl));