当前位置: 首页>>代码示例>>C#>>正文


C# IAppBuilder.UseNinjectWebApi方法代码示例

本文整理汇总了C#中IAppBuilder.UseNinjectWebApi方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseNinjectWebApi方法的具体用法?C# IAppBuilder.UseNinjectWebApi怎么用?C# IAppBuilder.UseNinjectWebApi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppBuilder的用法示例。


在下文中一共展示了IAppBuilder.UseNinjectWebApi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configuration

        public void Configuration(IAppBuilder app)
        {
            var policy = new CorsPolicy
            {
                AllowAnyHeader = true,
                AllowAnyMethod = true,
                SupportsCredentials = true
            };

            policy.ExposedHeaders.Add("Authorization");

            app.UseCors(new CorsOptions
            {
                PolicyProvider = new CorsPolicyProvider
                {
                    PolicyResolver = context => Task.FromResult(policy)
                }
            });

            var config = new HttpConfiguration();

            WebApiConfig.Register(config);

            app.UseNinjectMiddleware(CreateKernel);
            app.UseNinjectWebApi(config);

        }
开发者ID:IbrahimAmin,项目名称:MR-Reporting-System,代码行数:27,代码来源:Startup.cs

示例2: UseWebApi

            private static void UseWebApi(IAppBuilder application, IKernel kernel)
            {
                var config = new HttpConfiguration();
                config.MapHttpAttributeRoutes();
                var cors = new EnableCorsAttribute("*", "*", "*");

                //GlobalConfiguration.Configure(configuration =>
                //{
                //    configuration.SuppressDefaultHostAuthentication();
                //    configuration.MapHttpAttributeRoutes();
                //    configuration.EnableCors(cors);
                //    configuration.Filters.Add(new HostAuthenticationAttribute(OAuthDefaults.AuthenticationType));
                //    var jsonformatter = configuration.Formatters.JsonFormatter;
                //    jsonformatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
                //    configuration.AddJsonpFormatter();
                //    application.UseNinjectMiddleware(() => kernel);
                //    application.UseNinjectWebApi(configuration);
                //    application.UseWebApi(configuration);
                //});
                config.SuppressDefaultHostAuthentication();
                ConfigureOAuth(application);
                config.EnableCors(cors);
                config.Filters.Add(new HostAuthenticationAttribute(OAuthDefaults.AuthenticationType));
                var jsonformatter = config.Formatters.JsonFormatter;
                jsonformatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
                config.AddJsonpFormatter();

                application.UseNinjectMiddleware(() => kernel);
                application.UseNinjectWebApi(config);
                application.UseWebApi(config);

                application.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            }
开发者ID:buenokinder,项目名称:blacksails-middleware,代码行数:33,代码来源:StartupConfig.cs

示例3: Configuration

        public void Configuration(IAppBuilder app)
        {
            var config = CreateHttpConfiguration();

            app.UseNinjectMiddleware(Ninject.CreateKernel);
            app.UseNinjectWebApi(config);
        }
开发者ID:alexvance89,项目名称:tinder-api,代码行数:7,代码来源:Startup.cs

示例4: Configuration

        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration();
            WebApiConfig.Register(config);

            app.UseNinjectMiddleware(() => NinjectConfig.CreateKernel.Value);
            app.UseNinjectWebApi(config);
        }
开发者ID:RuzmanovDev,项目名称:TelerikAcademy,代码行数:8,代码来源:Startup.cs

示例5: Configuration

        public void Configuration(IAppBuilder appBuilder)
        {
            var config = new HttpConfiguration();
            WebApiConfig.Register(config);

            appBuilder.UseNinjectMiddleware(CreateKernel);
            appBuilder.UseNinjectWebApi(config);
        }
开发者ID:Philyorkshire,项目名称:AnswerSpaTest,代码行数:8,代码来源:Startup.cs

示例6: Configuration

        /// <summary>
        /// Configures the OWIN runtime
        /// </summary>
        /// <param name="app">The application builder</param>
        public void Configuration(IAppBuilder app)
        {
            app.UseOAuthAuthorizationServer(BlobstoreConfiguration.CreateAuthorizationOptions());
            app.UseOAuthBearerAuthentication(BlobstoreConfiguration.CreateAuthenticationOptions());
            app.UseNinjectMiddleware(BlobstoreConfiguration.CreateKernel);

            app.UseNinjectWebApi(BlobstoreConfiguration.CreateHttpConfiguration(AddElmahHandleErrorApiAttribute));
        }
开发者ID:froko,项目名称:bbv.Blobstore,代码行数:12,代码来源:Startup.cs

示例7: Configuration

        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration config = new HttpConfiguration();
            ConfigureOAuth(app);

            WebApiConfig.Register(config);
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            app.UseNinjectMiddleware(CreateKernel);
            app.UseNinjectWebApi(config);
        }
开发者ID:lachezar1990,项目名称:test8,代码行数:10,代码来源:Startup.cs

示例8: ConfigureNinject

        public IKernel ConfigureNinject(IAppBuilder app, HttpConfiguration httpConfig)
        {                       
            var kernel = CreateKernel(app);
            RegisterServiceLocator(kernel);

            app.UseNinjectMiddleware(() => kernel);
            app.UseNinjectWebApi(httpConfig);

            return kernel;
        }
开发者ID:TkachukOrest,项目名称:Catch-Me-If-You-Can,代码行数:10,代码来源:Startup.cs

示例9: Configure

            public void Configure(IAppBuilder appBuilder, IKernel kernel)
            {
                var config = new HttpConfiguration();

                config.MapHttpAttributeRoutes();
                config.MapDefinedRoutes();

                appBuilder.UseNinjectMiddleware(() => kernel);
                appBuilder.UseNinjectWebApi(config);
            }
开发者ID:buenokinder,项目名称:blacksails-middleware,代码行数:10,代码来源:StartupConfig.cs

示例10: Configuration

        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);

            var config = new HttpConfiguration();
            WebApiConfig.Register(config);
            app.UseNinjectMiddleware(() => NinjectConfig.CreateKernel.Value);
            app.UseNinjectWebApi(config);

            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
        }
开发者ID:NativeScriptHybrids,项目名称:ChallengeAccepted,代码行数:11,代码来源:Startup.cs

示例11: ConfigureWebApi

        public void ConfigureWebApi(IAppBuilder app)
        {
            HttpConfiguration config = new HttpConfiguration();
            config.MapHttpAttributeRoutes();

            var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().First();
            jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            jsonFormatter.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;

            app.UseNinjectWebApi(config);
        }
开发者ID:rmaziarka,项目名称:MediatR.Examples,代码行数:11,代码来源:Startup.cs

示例12: Configuration

        /// <summary>
        /// Creates a configuration.
        /// </summary>
        /// <param name="app">
        /// The app.
        /// </param>
        public void Configuration(IAppBuilder app)
        {
            var webApiConfiguration = new HttpConfiguration();
            webApiConfiguration.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "{controller}/{id}",
                defaults: new { id = RouteParameter.Optional, controller = "values" });

            app.UseNinjectMiddleware(CreateKernel);
            app.UseNinjectWebApi(webApiConfiguration);
        }
开发者ID:ninject,项目名称:Ninject.Web.WebApi,代码行数:17,代码来源:Startup.cs

示例13: Configuration

        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration();

            config.Formatters.Clear();
            config.Formatters.Add(new JsonMediaTypeFormatter());

            config.MapHttpAttributeRoutes();
            config.EnsureInitialized();

            app.UseNinjectMiddleware(CreateKernel);
            app.UseNinjectWebApi(config);
        }
开发者ID:avgoncharov,项目名称:BuildRevisionCounter,代码行数:13,代码来源:Startup.cs

示例14: Configure

            public void Configure(IAppBuilder appBuilder, IKernel kernel)
            {
                var config = new HttpConfiguration();

                config.MapHttpAttributeRoutes();
                config.MapDefinedRoutes();
                config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));

                log4net.Config.XmlConfigurator.Configure();

                appBuilder.UseNinjectMiddleware(() => kernel);
                appBuilder.UseNinjectWebApi(config);
            }
开发者ID:rehan88,项目名称:BillAPI,代码行数:13,代码来源:StartupConfig.cs

示例15: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.UseCors(CorsOptions.AllowAll);

            ConfigureAuth(app);

            var config = new HttpConfiguration();
            WebApiConfig.Register(config);
            DatabaseConfig.Initialize();
            MappingConfig.Initialize();

            app.UseNinjectMiddleware(() => NinjectConfig.CreateKernel.Value);
            app.UseNinjectWebApi(config);
        }
开发者ID:Team-Tyche,项目名称:Just-DIY,代码行数:14,代码来源:Startup.cs


注:本文中的IAppBuilder.UseNinjectWebApi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。