Example #1
0
        public REstateHost(IComponentContainer container)
            : this()
        {
            var configuration = new HostConfiguration(container);

            configuration.RegisterDefaults();

            HostConfiguration = configuration;
        }
Example #2
0
        /// <summary>
        /// Instructs REstate to use a custom container for all components.
        /// Defaults will be registered into the specified container.
        /// </summary>
        /// <param name="host">The host to modify</param>
        /// <param name="container">The container to use.</param>
        private static bool TryUseContainer(REstateHost host, IComponentContainer container)
        {
            if (host.HostConfiguration == null)
            {
                lock (host.ConfigurationSyncRoot)
                {
                    if (host.HostConfiguration == null)
                    {
                        var configuration = new HostConfiguration(container);

                        configuration.RegisterDefaults();

                        host.HostConfiguration = configuration;

                        return(true);
                    }
                }
            }

            return(false);
        }