BuildContainer() public static method

Configures and builds Autofac IOC container.
public static BuildContainer ( ) : IContainer
return IContainer
        public void Setup()
        {
            try
            {
                container = Bootstrapper.BuildContainer();

                svcArticleHost = new ServiceHost(typeof(ArticleService), svcArticleServiceURI);
                svcBlogHost    = new ServiceHost(typeof(BlogService), svcBlogServiceURI);

                svcArticleHost.AddDependencyInjectionBehavior <Business.Services.Contracts.IArticleService>(container);
                svcBlogHost.AddDependencyInjectionBehavior <Business.Services.Contracts.IBlogService>(container);

                svcArticleHost.Open();
                svcBlogHost.Open();
            }
            catch (Exception ex)
            {
                svcArticleHost = null;
                svcBlogHost    = null;
            }
        }
示例#2
0
        public void Setup()
        {
            try
            {
                container = Bootstrapper.BuildContainer();

                svcProductoHost = new ServiceHost(typeof(ProductoService), svcProductoServiceURI);
                svcPedidoHost   = new ServiceHost(typeof(PedidoService), svcPedidoServiceURI);

                svcProductoHost.AddDependencyInjectionBehavior <Business.Services.Contracts.IProductoService>(container);
                svcPedidoHost.AddDependencyInjectionBehavior <Business.Services.Contracts.IPedidoService>(container);

                svcPedidoHost.Open();
                svcProductoHost.Open();
            }
            catch (Exception ex)
            {
                svcPedidoHost   = null;
                svcProductoHost = null;
            }
        }