Example #1
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            config.Formatters.Add(new BrowserJsonFormatter());

            // Web API routes
            config.MapHttpAttributeRoutes();
            config.DependencyResolver = new StructureMapResolver(IocFactory.GetContainer());

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
        public static void ArrangeMvcDependencyResolver()
        {
            var dependencyResolver = new StructureMapResolver(IocFactory.GetContainer());

            DependencyResolver.SetResolver(dependencyResolver);
        }