Beispiel #1
0
        public void Configuration(IAppBuilder app)
        {
            IContainer container = RegisterServices();
            HttpConfiguration config = new HttpConfiguration();
            config.Routes.MapHttpRoute("DefaultHttpRoute", "api/{controller}");

            AutofacOwinDependencyResolver resolver = new AutofacOwinDependencyResolver(container);

            app.UseDependencyResolver(resolver)
               .Use<RandomTextMiddleware>()
               .UseWebApiWithOwinDependencyResolver(resolver, config);
        }
Beispiel #2
0
 public static IAppBuilder UseAutofacDependencyResolver(this IAppBuilder app, IContainer container)
 {
     AutofacOwinDependencyResolver resolver = new AutofacOwinDependencyResolver(container);
     return app.UseDependencyResolver(resolver);
 }