System.Web.Routing凋兆腎寂旗鷹盾裂?眉? RouteCollection窃
RouteCollection窃写覚噐Collection<RouteBase>旺拝淫廾阻匯倖Dictionary<string, RouteBase>?噐頁万戻工阻屈宀議孔嬬。 宥狛賀心旗鷹厘断辛參岑祇?Collection嶄才Dictionary嶄議方象旺音頼畠?揖。 1.嗤Name議Route屡贋噐D嶄嗽贋噐C嶄?旺拝辛參宥狛沫哈奉來宥狛Name殊沫?歌心Add圭隈? 2.短嗤Name議Route峪贋噐C嶄 3.評茅Route議扮昨?泌惚D嶄匆贋壓万?夸貫D嶄匆評茅?歌心RemoveItem圭隈? 4.譜崔Route議扮昨?泌惚D嶄匆贋壓万?夸貫D嶄匆評茅(歌心SetItem圭隈?宸泣俶勣蒙艶廣吭) 宸倖窃嶄婢?阻匯嶽載挫議迄字崙?萩歌心旗鷹嶄議仔弼互疏何蛍? 云窃嶄議凪麿圭隈參朔氏壓 Route窃?和?嶄讐。 using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Security.Permissions; using System.Threading; using System.Web; using System.Web.Hosting; namespace System.Web.Routing { [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] public class RouteCollection : Collection<RouteBase> { // Fields private Dictionary<string, RouteBase> _namedMap; private ReaderWriterLock _rwLock; private VirtualPathProvider _vpp; // Methods public RouteCollection() : this(HostingEnvironment.VirtualPathProvider) {} public RouteCollection(VirtualPathProvider virtualPathProvider) { this._namedMap = new Dictionary<string, RouteBase>(StringComparer.OrdinalIgnoreCase); this._rwLock = new ReaderWriterLock(); this._vpp = virtualPathProvider; } public void Add(string name, RouteBase item) { if (item == null) throw new ArgumentNullException("item"); if (!string.IsNullOrEmpty(name) && this._namedMap.ContainsKey(name)) throw new ArgumentException( string.Format(CultureInfo.CurrentUICulture, RoutingResources.RouteCollection_DuplicateName, new object[] {name}), "name"); base.Add(item); if (!string.IsNullOrEmpty(name)) this._namedMap[name] = item; } protected override void ClearItems() { this._namedMap.Clear(); base.ClearItems(); } private RequestContext GetRequestContext(RequestContext requestContext) { if (requestContext != null) return requestContext; HttpContext current = HttpContext.Current; if (current == null) throw new InvalidOperationException(RoutingResources.RouteCollection_RequiresContext); return new RequestContext(new HttpContextWrapper(current), new RouteData()); } public RouteData GetRouteData(HttpContextBase httpContext) { if (httpContext == n |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |