示例#1
0
        protected Host( Host existing )
            : base( existing )
        {
            Arg.NotNull( existing, nameof( existing ) );

            activityConfigurations = existing.activityConfigurations;
            activityTypes = existing.activityTypes;
            configSettingLocator = existing.configSettingLocator;
            configuration = existing.configuration;
            containerConfigurations = existing.containerConfigurations;
            conventionsHolder = existing.conventionsHolder;

            var boundaryNames = new Dictionary<string, object> { { "SharingBoundaryNames", new[] { Boundary.PerRequest } } };
            var contract = new CompositionContract( typeof( ExportFactory<CompositionContext> ), null, boundaryNames );
            var factory = (ExportFactory<CompositionContext>) existing.Container.GetExport( contract );

            container = new Lazy<CompositionContext>( () => factory.CreateExport().Value );
        }
        /// <summary>
        /// Begin initialization of the application.
        /// </summary>
        /// <remarks>Note to inheritors: The base implementation does not perform any action.</remarks>
        public virtual void BeginInit()
        {
            if ( IsInitialized )
                return;

            host = CreateHost();
            host.AddService( typeof( IApplicationState ), this );
        }