Example #1
0
        /// <summary>
        /// Registers API Controllers and dependencies.
        /// </summary>
        /// <param name="config">The configuration to inject.</param>
        public static void Register(HttpConfiguration config)
        {
            var conString          = GetConfig("DB.ConnectionStringKey");
            var tinyUrlBaseAddress = GetConfig("TinyUrlBaseAddress");

            var builder = new ContainerBuilder();

            builder
            .AddAssemblyApis()
            .AddRepository(conString)
            .AddTinyUrlService(tinyUrlBaseAddress)
            .RegisterWebApiFilterProvider(config);

            config
            .AddRouting()
            .AddDependencyResolver(builder)
            .AddExceptionHandler();
        }