Esempio n. 1
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);
        }
Esempio n. 2
0
 public static IAgent Agent(this REstateHost host)
 {
     return(((IHasAgentLazy)host).AgentLazy.Value);
 }