Exemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="options">Container options.</param>
        public XerContainer(ContainerOptions options)
        {
            Options = options;

            LifetimeScopeManager = new LifetimeScopeManager(this);
            SingletonScope       = LifetimeScopeManager.CreateScope(SingletonLifetimeScopeName);
        }
Exemplo n.º 2
0
        // This method will never return null.
        internal static LifetimeScopeManager GetLifetimeScopeManager(this Container container)
        {
            var manager = (LifetimeScopeManager)container.GetItem(ManagerKey);

            if (manager == null)
            {
                lock (ManagerKey)
                {
                    manager = (LifetimeScopeManager)container.GetItem(ManagerKey);

                    if (manager == null)
                    {
                        manager = new LifetimeScopeManager();
                        container.SetItem(ManagerKey, manager);
                    }
                }
            }

            return(manager);
        }
Exemplo n.º 3
0
 public LifetimeScope BeginLifetimeScope(string scopeName)
 {
     return(LifetimeScopeManager.CreateScope(scopeName));
 }
Exemplo n.º 4
0
 public LifetimeScope BeginLifetimeScope()
 {
     return(LifetimeScopeManager.CreateScope(DateTime.Now.Ticks.GetHashCode().ToString()));
 }