コード例 #1
0
        /// <summary>
        /// Starts a new <see cref="IContextFactory"/> and sets it as current.
        /// </summary>
        /// <param name="configuration">
        /// The configuration.
        /// </param>
        /// <returns>
        /// The <see cref="IContextFactory"/>.
        /// </returns>
        public static IContextFactory StartNew(ContextFactoryConfiguration configuration)
        {
            configuration.ThrowIfNull("configuration");
            lock (SyncRoot)
            {
                if (currentContextFactory != null)
                {
                    var oldContextFactory = currentContextFactory;
                    currentContextFactory = null;
                    oldContextFactory.Dispose();
                }

                var contextFactory = new DefaultContextFactory(configuration);
                contextFactory.Start();
                currentContextFactory = contextFactory;
                return contextFactory;
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultContextFactory"/> class.
 /// </summary>
 /// <param name="configuration">
 /// The configuration.
 /// </param>
 public DefaultContextFactory(ContextFactoryConfiguration configuration)
 {
     this.configuration = configuration;
     this.IsReady = false;
 }