public void Init() { Container container = new Container(); container.Options.DefaultLifestyle = Lifestyle.Singleton; IPackage[] packages = RegisterPackages(); foreach (IPackage package in packages) { package.RegisterServices(container); } new UtilityModule().RegisterServices(container); container.Verify(); dataCommiter = container.GetInstance <IDataCommiter>(); userDataStore = container.GetInstance <ITemporaryInMemoryDataStore <Guid, User> >(); promotionDataStore = container.GetInstance <ITemporaryInMemoryDataStore <Guid, Promotion> >(); IEnumerable <IInitializer> initializers = container.GetAllInstances <IInitializer>(); foreach (IInitializer initializer in initializers) { initializer.Initialize(); } }
public DataCommiterCleanerDecorator(ICleanable cleaner, IDataCommiter dataCommiter) { this.cleaner = cleaner ?? throw new ArgumentNullException($"{nameof(cleaner)} should not be null"); this.dataCommiter = dataCommiter ?? throw new ArgumentNullException($"{nameof(dataCommiter)} should not be null"); }