protected override void Arrange() { base.Arrange(); var lookup = Container.Resolve<ElementLookup>(); sectionViewModel = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, LoggingSection); sectionViewModel.Initialize(new InitializeContext()); lookup.AddSection(sectionViewModel); }
protected override void Arrange() { base.Arrange(); var lookup = Container.Resolve <ElementLookup>(); sectionViewModel = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, LoggingSection); sectionViewModel.Initialize(new InitializeContext()); lookup.AddSection(sectionViewModel); }
protected override void Act() { connectionStringsModel = SectionViewModel.CreateSection(Container, "connectionStrings", section); connectionStringsModel.Initialize(new InitializeContext(null)); }
public static void InitializeSection(SectionViewModel section, InitializeContext context) { //first init section section.Initialize(context); // then initialize elements var elements = section.DescendentElements().OfType<ElementViewModel>(); foreach (var element in elements) { element.Initialize(context); } //then init properties var sectionPropertiesThatNeedInitialization = section.Properties; var propertiesOfContainedElementsThatNeedInitialization = section.DescendentElements().SelectMany(x => x.Properties); foreach (var propertyThatNeedsInitialization in sectionPropertiesThatNeedInitialization.Concat( propertiesOfContainedElementsThatNeedInitialization)) { propertyThatNeedsInitialization.Initialize(context); } }