Exemplo n.º 1
0
        protected static void ConfiguraUnityConfig(RegisterTypesDelegate pRegisterTypesDelegate)
        {
            _container = new Lazy <IUnityContainer>(() =>
            {
                var container = new UnityContainer();
                ContainerIoc  = new ContainerUnity(container);

                if (RegisterTypesDelegate != null)
                {
                    RegisterTypesDelegate.Invoke(container);
                }
                else
                {
                    throw new ArgumentException("O método RegisterTypes não foi configurado e/ou chamado corretamente, verifique se o método ConfiguraUnityConfig foi chamado passando o método de registro de tipos por delegate");
                }

                return(container);
            });
            RegisterTypesDelegate = pRegisterTypesDelegate;
        }