示例#1
0
        public static IEndpointRouteBuilder RegisterDiscDataHandler(this IEndpointRouteBuilder builder, string virtPath, string physPath, bool publicRoute = false)
        {
            if (virtPath != "/")
            {
                var handler = new DiscDataHandler(physPath, !publicRoute);
                var url     = virtPath + "{*pathInfo}";

                if (!builder.DataSources.Any(r => r.Endpoints.Any(e => e.DisplayName == url)))
                {
                    builder.Map(url, handler.Invoke);

                    var newUrl = url.Replace("{0}", "{t1}/{t2}/{t3}");

                    if (newUrl != url)
                    {
                        builder.Map(url, handler.Invoke);
                    }
                }
            }

            return(builder);
        }
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            var path = DiscDataHandler.CombinePath(_physPath, requestContext);

            return(new PublicDiscDataHandler(path));
        }