示例#1
0
        // This method gets called by a runtime.
        // Use this method to add services to the container
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            // Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
            // You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
            // services.AddWebApiConventions();

            //services.AddTransient<IProductFinder, ProductFinder>();

            var container = new UnityContainer();
            container.Populate(services);
            container.Resolve<IScopedInstance<ActionContext>>();

            container.RegisterType<IProductFinder, ProductFinder>();

            return container.Resolve<IServiceProvider>();
        }