Пример #1
0
        public EggFarmService()
        {
            var config = new HttpSelfHostConfiguration("http://localhost:3000");

            RouteRegistrar.RegisterMappings(config.Routes);
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            var builder = new ContainerBuilder();

            builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
            builder.RegisterModule <ServiceModule>();
            var container = builder.Build();
            var resolver  = new AutofacWebApiDependencyResolver(container);

            config.DependencyResolver = resolver;
            server = new HttpSelfHostServer(config);
            MappingInitializer.Initialize();
        }