private bool LoadAPI() { var p = Request.Url.AbsolutePath; var mc = Regex.Match(p, @"/([^/]+)/([^/]+)\.ashx$", RegexOptions.IgnoreCase); if (!mc.Success) return false; //var l = LightDataModel.tbl_sp_api_urlItem.GetQueries(dBase); //l.Filter.AndFilters.Add(LightDataModel.tbl_sp_api_urlItem.Fields.Disable, false); if (Regex.IsMatch(mc.Groups[1].Value, "^\\d+$"))//指定了ID作为目录 { int id = int.Parse(mc.Groups[1].Value); api = LightDataModel.tbl_sp_api_urlItem.QueryById(dBase, id); if (api.Disable) api = null; //l.Filter.AndFilters.Add(LightDataModel.tbl_sp_api_urlItem.Fields.id, id); } else { //l.Filter.AndFilters.Add(LightDataModel.tbl_sp_api_urlItem.Fields.virtual_page, mc.Groups[2].Value); api = LightDataModel.tbl_sp_api_urlItem.QueryByVirtualPage(dBase, mc.Groups[2].Value); } //api = l.GetRowByFilters(); return api != null; }
private bool LoadAPI() { var p = Request.Url.AbsolutePath; var mc = Regex.Match(p, @"/([^/]+)/([^/]+)\.ashx$", RegexOptions.IgnoreCase); if (!mc.Success) { return(false); } if (Regex.IsMatch(mc.Groups[1].Value, "^\\d+$"))//指定了ID作为目录 { int id = int.Parse(mc.Groups[1].Value); api = LightDataModel.tbl_sp_api_urlItem.QueryById(dBase, id); if (api.Disable) { api = null; } } else { api = LightDataModel.tbl_sp_api_urlItem.QueryByVirtualPage(dBase, mc.Groups[2].Value); } return(api != null); }