public DefaultContainerProfile(IFacilityProfile[] facilities, ISubSystemProfile[] subsystems, IComponentProfile[] components, IContainerProfile[] subContainers) { m_facilities = facilities; m_subsystems = subsystems; m_components = components; m_subContainers = subContainers; }
public void SelectProfile(IContainerProfile selectedProfile) { foreach (var profile in _profiles) { profile.Selected = false; } selectedProfile.Selected = true; }
public static void Parse(this IContainerProfile profile, XmlNode node) { profile.Selected = node.BoolAttribute(Xml.Attributes.Selected); profile.ContainerProfileName = node.ChildNodes.GetTextValue(Xml.ContainerProfile.ProfileName, Xml.Attributes.Value); profile.Repository = node.ChildNodes.GetTextValue(Xml.ContainerProfile.Repository, Xml.Attributes.Value); profile.Folder = node.ChildNodes.GetTextValue(Xml.ContainerProfile.Folder, Xml.Attributes.Value); profile.SitecoreAdminPassword = node.ChildNodes.GetTextValue(Xml.ContainerProfile.SitecoreAdminPassword, Xml.Attributes.Value); profile.SaPassword = node.ChildNodes.GetTextValue(Xml.ContainerProfile.SaPassword, Xml.Attributes.Value); profile.InitializeScript = node.ChildNodes.GetTextValue(Xml.ContainerProfile.InitializeScript, Xml.Attributes.Value); profile.Notes = node.ChildNodes.GetTextValue(Xml.ContainerProfile.Notes, Xml.Attributes.Value); }
public void Add(IContainerProfile p) { var profile = new ContainerProfile { ContainerProfileName = p.ContainerProfileName, Repository = p.Repository, Folder = p.Folder, SitecoreAdminPassword = p.SitecoreAdminPassword, SaPassword = p.SaPassword, InitializeScript = p.InitializeScript, Notes = p.Notes }; _profiles = _profiles.Append(profile); }
public static XElement Save(this IContainerProfile profile) { var root = new XElement(Xml.ContainerProfile.NodeName); if (profile.Selected) { root.SetAttributeValue(Xml.Attributes.Selected, true); } var profileName = new XElement(Xml.ContainerProfile.ProfileName); profileName.SetAttributeValue(Xml.Attributes.Value, profile.ContainerProfileName); root.Add(profileName); var repository = new XElement(Xml.ContainerProfile.Repository); repository.SetAttributeValue(Xml.Attributes.Value, profile.Repository); root.Add(repository); var folder = new XElement(Xml.ContainerProfile.Folder); folder.SetAttributeValue(Xml.Attributes.Value, profile.Folder); root.Add(folder); var adminPassword = new XElement(Xml.ContainerProfile.SitecoreAdminPassword); adminPassword.SetAttributeValue(Xml.Attributes.Value, profile.SitecoreAdminPassword); root.Add(adminPassword); var saPassword = new XElement(Xml.ContainerProfile.SaPassword); saPassword.SetAttributeValue(Xml.Attributes.Value, profile.SaPassword); root.Add(saPassword); var script = new XElement(Xml.ContainerProfile.InitializeScript); script.SetAttributeValue(Xml.Attributes.Value, profile.InitializeScript); root.Add(script); var notes = new XElement(Xml.ContainerProfile.Notes); notes.SetAttributeValue(Xml.Attributes.Value, profile.Notes); root.Add(notes); return(root); }
protected virtual void SetupSubsystems(IContainerProfile profile, IContainer container) { IKernelSubsystem subsystem = new ComponentProfileAdapterSubsystem(profile.ComponentProfiles); container.MicroKernel.AddSubsystem(KernelConstants.CONFIGURATION, subsystem); }
protected virtual void SetupFacilities(IContainerProfile profile, IContainer container) { container.MicroKernel.AddFacility("Default", new ConfigurationOverrideFacility(profile.ComponentProfiles)); }
protected virtual void AddFacilities(IContainerProfile profile, IContainer container) { foreach(IFacilityProfile facility in profile.Facilities) { IKernelFacility instance = Activator.CreateInstance(facility.Implementation) as IKernelFacility; container.MicroKernel.AddFacility(facility.Key, instance); } }
protected virtual void AddComponents(IContainerProfile profile, IContainer container) { foreach(IComponentProfile component in profile.ComponentProfiles) { container.MicroKernel.AddComponent(component.Key, component.Service, component.Implementation); } }
public virtual IContainer Build(IContainerProfile profile) { IContainer container = Build(); SetupSubsystems(profile, container); SetupFacilities(profile, container); AddFacilities(profile, container); AddComponents(profile, container); return container; }
public ContainerRepository(IContainer container) { _container = container; _profile = container.Resolve<IContainerProfile>(); }
public ContainerContext(IContainerProfile profile, IMockProvider provider) { _profile = profile ?? throw new ArgumentNullException(nameof(profile)); _provider = provider ?? throw new ArgumentNullException(nameof(provider)); }
public ContainerContext(IContextProvider contextProvider, IContainerProfile profile) { _profile = profile; _contextProvider = contextProvider; }
public ContainerRepository(IContainer container) { _container = container; _profile = container.Resolve <IContainerProfile>(); }
private void AssertProfileComponent(IContainerProfile profile, String key, Type service, Type impl) { AssertNotNull( profile ); AssertEquals( 1, profile.ComponentProfiles.Length ); AssertEquals( 0, profile.Facilities.Length ); IComponentProfile component = profile.ComponentProfiles[0]; AssertNotNull( component ); AssertEquals( key, component.Key ); AssertEquals( service, component.Service ); AssertEquals( impl, component.Implementation ); AssertEquals( Lifestyle.Undefined, component.Lifestyle ); AssertEquals( Activation.Undefined, component.Activation ); AssertNotNull( component.Configuration ); }
private void AssertProfileComponent(IContainerProfile profile) { AssertProfileComponent( profile, "a", typeof(IService), typeof(DefaultService) ); }