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


C# AppFunc类代码示例

本文整理汇总了C#中AppFunc的典型用法代码示例。如果您正苦于以下问题:C# AppFunc类的具体用法?C# AppFunc怎么用?C# AppFunc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Http2OwinMessageHandler

 /// <summary>
 /// Initializes a new instance of the <see cref="Http2OwinMessageHandler"/> class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <param name="end"></param>
 /// <param name="transportInfo">The transport information.</param>
 /// <param name="next">The next layer delegate.</param>
 /// <param name="cancel">The cancellation token.</param>
 public Http2OwinMessageHandler(DuplexStream stream, ConnectionEnd end, TransportInformation transportInfo,
                         AppFunc next, CancellationToken cancel)
     : base(stream, end, stream.IsSecure, transportInfo, cancel)
 {
     _next = next;
     stream.OnClose += delegate { Dispose(); };
 }
开发者ID:jamesgodfrey,项目名称:http2-katana,代码行数:15,代码来源:Http2OwinMessageHandler.cs

示例2: Error404Module

        public Error404Module(AppFunc next)
        {
            if (next == null)
                throw new ArgumentNullException("next");

            this.next = next;
        }
开发者ID:KonstantinKolesnik,项目名称:SmartHub,代码行数:7,代码来源:Error404Module.cs

示例3: Http2OwinMessageHandler

 /// <summary>
 /// Initializes a new instance of the <see cref="Http2OwinMessageHandler"/> class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <param name="end"></param>
 /// <param name="isSecure"></param>
 /// <param name="next">The next layer delegate.</param>
 /// <param name="cancel">The cancellation token.</param>
 public Http2OwinMessageHandler(Stream stream, ConnectionEnd end, bool isSecure,
                         AppFunc next, CancellationToken cancel)
     : base(stream, end, isSecure, cancel)
 {
     _next = next;
     _session.OnSessionDisposed += delegate { Dispose(); };
 }
开发者ID:Nangal,项目名称:http2-katana,代码行数:15,代码来源:Http2OwinMessageHandler.cs

示例4: CarcarahOAuth

 public CarcarahOAuth(AppFunc next, OAuthOptions options)
 {
     this.next = next;
     this.options = options;
     AuthCodeStorage = new AuthorizationCodeStorage();
     RefreshTokenStorage = new RefreshTokenStorage();
 }
开发者ID:yanjustino,项目名称:CarcarahOAuth2,代码行数:7,代码来源:CarcarahOAuth.cs

示例5: Html5Middleware

        public Html5Middleware(AppFunc next, HTML5ServerOptions options)
        {
            _next = next;
            _options = options;

            _innerMiddleware = new StaticFileMiddleware(next, options.FileServerOptions.StaticFileOptions);
        }
开发者ID:kulish-alina,项目名称:HR_Project,代码行数:7,代码来源:Html5RoutingConfig.cs

示例6: Enable

		public static AppFunc Enable(AppFunc next, Func<IDictionary<string, object>, bool> requiresAuth, string realm, Func<string, UserPassword?> authenticator)
		{
			return env =>
			{
				if (!requiresAuth(env))
				{
					return next(env);
				}

				var requestHeaders = (IDictionary<string, string[]>)env[OwinConstants.RequestHeaders];

				var header = OwinHelpers.GetHeader(requestHeaders, "Authorization");

				var parsedHeader = ParseDigestHeader(header);

				if (parsedHeader == null)
				{
					return Unauthorized(env, realm);
				}

				string user = parsedHeader["username"];
				var pwd = authenticator(user);

				// TODO: check for increment of "nc" header value

				if (!pwd.HasValue || !IsValidResponse(pwd.Value.GetHA1(user, realm), (string)env[OwinConstants.RequestMethod], parsedHeader))
				{
					return Unauthorized(env, realm);
				}

				env["gate.RemoteUser"] = user;
				return next(env);
			};
		}
开发者ID:Boddlnagg,项目名称:WordsLive,代码行数:34,代码来源:DigestAuthentication.cs

示例7: RazorApplication

        // Consumers should use IoC or the Default UseRazor extension method to initialize this.
        public RazorApplication(
            AppFunc nextApp,
            IFileSystem fileSystem,
            string virtualRoot,
            IRouter router,
            ICompilationManager compiler,
            IPageActivator activator,
            IPageExecutor executor,
            ITraceFactory tracer)
            : this(nextApp)
        {
            Requires.NotNull(fileSystem, "fileSystem");
            Requires.NotNullOrEmpty(virtualRoot, "virtualRoot");
            Requires.NotNull(router, "router");
            Requires.NotNull(compiler, "compiler");
            Requires.NotNull(activator, "activator");
            Requires.NotNull(executor, "executor");
            Requires.NotNull(tracer, "tracer");

            FileSystem = fileSystem;
            VirtualRoot = virtualRoot;
            Router = router;
            CompilationManager = compiler;
            Executor = executor;
            Activator = activator;
            Tracer = tracer;

            ITrace global = Tracer.ForApplication();
            global.WriteLine("Started at '{0}'", VirtualRoot);
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:31,代码来源:RazorApplication.cs

示例8: OwinFriendlyExceptionsMiddleware

 public OwinFriendlyExceptionsMiddleware(AppFunc next, ITransformsCollection transformsCollection,
     OwinFriendlyExceptionsParameters parameters)
 {
     _next = next;
     _transformsCollection = transformsCollection;
     _parameters = parameters;
 }
开发者ID:Xamarui,项目名称:OwinFriendlyExceptions,代码行数:7,代码来源:OwinFriendlyExceptionsMiddleware.cs

示例9: Create

        public static IDisposable Create(AppFunc app, IDictionary<string, object> properties)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (properties == null)
            {
                throw new ArgumentNullException("properties");
            }

            // Retrieve the instances created in Initialize
            OwinHttpListener wrapper = properties.Get<OwinHttpListener>(typeof(OwinHttpListener).FullName)
                ?? new OwinHttpListener();
            System.Net.HttpListener listener = properties.Get<System.Net.HttpListener>(typeof(System.Net.HttpListener).FullName)
                ?? new System.Net.HttpListener();

            AddressList addresses = properties.Get<AddressList>(Constants.HostAddressesKey)
                ?? new List<IDictionary<string, object>>();

            CapabilitiesDictionary capabilities =
                properties.Get<CapabilitiesDictionary>(Constants.ServerCapabilitiesKey)
                    ?? new Dictionary<string, object>();

            var loggerFactory = properties.Get<LoggerFactoryFunc>(Constants.ServerLoggerFactoryKey);

            wrapper.Start(listener, app, addresses, capabilities, loggerFactory);
            return wrapper;
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:29,代码来源:OwinServerFactory.cs

示例10: ResttpComponent

        public ResttpComponent(AppFunc next, ResttpConfiguration config)
        {
            _next = next;
            Config = config;

            //TestRoutes(new HttpRouteResolver(Config.HttpRoutes));
        }
开发者ID:dovydasvenckus,项目名称:Resttp,代码行数:7,代码来源:ResttpComponent.cs

示例11: CanonicalRequestPatterns

        public CanonicalRequestPatterns(AppFunc next)
        {
            _next = next;

            _paths = new Dictionary<string, Tuple<AppFunc, string>>();
            _paths["/"] = new Tuple<AppFunc, string>(Index, null);

            var items = GetType().GetMethods()
                .Select(methodInfo => new
                {
                    MethodInfo = methodInfo,
                    Attribute = methodInfo.GetCustomAttributes(true).OfType<CanonicalRequestAttribute>().SingleOrDefault()
                })
                .Where(item => item.Attribute != null)
                .Select(item => new
                {
                    App = (AppFunc)Delegate.CreateDelegate(typeof(AppFunc), this, item.MethodInfo),
                    item.Attribute.Description,
                    item.Attribute.Path,
                });

            foreach (var item in items)
            {
                _paths.Add(item.Path, Tuple.Create(item.App, item.Description));
            }
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:26,代码来源:CanonicalRequestPatterns.cs

示例12: MapPathMiddleware

        public MapPathMiddleware(AppFunc next, AppFunc branch, string pathMatch)
        {
            if (next == null)
            {
                throw new ArgumentNullException("next");
            }
            if (branch == null)
            {
                throw new ArgumentNullException("branch");
            }
            if (pathMatch == null)
            {
                throw new ArgumentNullException("pathMatch");
            }
            // Must at least start with a "/foo" to be considered a branch. Otherwise it's a catch-all.
            if (!pathMatch.StartsWith("/", StringComparison.Ordinal) || pathMatch.Length == 1)
            {
                throw new ArgumentException("Path must start with a \"/\" followed by one or more characters.", "pathMatch");
            }

            // Only match on "/" boundaries, but permit the trailing "/" to be absent.
            if (pathMatch.EndsWith("/", StringComparison.Ordinal))
            {
                pathMatch = pathMatch.Substring(0, pathMatch.Length - 1);
            }

            _next = next;
            _branch = branch;
            _pathMatch = pathMatch;
        }
开发者ID:tkggand,项目名称:katana,代码行数:30,代码来源:MapPathMiddleware.cs

示例13: XXssMiddleware

 public XXssMiddleware(AppFunc next, XXssProtectionOptions options)
     : base(next)
 {
     _config = options;
     var headerGenerator = new HeaderGenerator();
     _headerResult = headerGenerator.CreateXXssProtectionResult(_config);
 }
开发者ID:modulexcite,项目名称:NWebsec,代码行数:7,代码来源:XXssMiddleware.cs

示例14: ActionInvokerComponent

 public ActionInvokerComponent(AppFunc next, MediaTypeFormatterCollection formatters, IContentNegotiator contentNegotiator, IActionParameterBinder parameterBinder)
 {
     _next = next;
     _formatters = formatters;
     _contentNegotiator = contentNegotiator;
     _actionParameterBinder = parameterBinder;
 }
开发者ID:dovydasvenckus,项目名称:Resttp,代码行数:7,代码来源:ActionInvokerComponent.cs

示例15: RouteBody

 public RouteBody(AppFunc next, string[] httpMethods, string paramKey, Func<Stream, object> converter)
 {
     this.next = next;
     this.routeParamName = paramKey;
     this.methods = httpMethods;
     this.converter = converter;
 }
开发者ID:Xamarui,项目名称:OwinUtils,代码行数:7,代码来源:RouteBody.cs


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