Пример #1
0
        public static void mapear(ref Container container)
        {
            Arquivos_IoC.mapear(ref container);

            Contribuicoes_IoC.mapear(ref container);

            Associados_IoC.mapear(ref container);
        }
Пример #2
0
        //Propriedades

        /// <summary>
        /// Registro de dependencias
        /// </summary>
        public static void register()
        {
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new WebRequestLifestyle();

            //Core
            container.Register <DataContext, DataContext>(Lifestyle.Scoped);

            //Notificacoes
            UTIL_IoC.mapear(ref container);

            //Organizacoes
            Organizacoes_IoC.mapear(ref container);

            //Configuracoes
            Configuracoes_IoC.mapear(ref container);


            //Notificacoes
            Notificacoes_IoC.mapear(ref container);

            //Arquivos/Arquivo Upload
            Arquivos_IoC.mapear(ref container);

            //Financeiro
            Financeiro_IoC.mapear(ref container);

            //Publicacoes
            Publicacoes_IoC.mapear(ref container);

            //Registrar controllers WEB API
            container.RegisterWebApiControllers(GlobalConfiguration.Configuration);

            //Check and resolve
            container.Verify();

            DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));

            GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);
        }