Esempio n. 1
0
        /// <summary>
        /// 查找目标路由数据
        /// </summary>
        /// <param name="formRouteData">目标路由数据</param>
        /// <returns>目标路由数据集合</returns>
        internal IList <AbstractRouteData> FindRouteData(AbstractFormRouteData formRouteData)
        {
            List <AbstractRouteData> routeDatas = new List <AbstractRouteData>();

            if (RouteFilterHelper.IsNotPassAllFilters(formRouteData, this.RouteFilters))
            {
                return(routeDatas);
            }
            foreach (var routeData in this.RouteDatas)
            {
                if (routeData.IsMatch(formRouteData, this.RouteMappers))
                {
                    routeDatas.Add(routeData);
                }
            }
            return(routeDatas);
        }
Esempio n. 2
0
        /// <summary>
        /// 是否匹配源路由数据
        /// </summary>
        /// <param name="formRouteData">目标路由数据</param>
        /// <param name="tableRouteMappers">路由表映射器</param>
        /// <returns></returns>
        public bool IsMatch(AbstractFormRouteData formRouteData, IList <AbstractRouteMapper> tableRouteMappers)
        {
            if (RouteFilterHelper.IsNotPassAllFilters(formRouteData, this.RouteFilters))
            {
                return(false);
            }
            var routeMappers = new List <AbstractRouteMapper>(tableRouteMappers.Count + this.RouteMappers.Count);

            routeMappers.AddRange(this.RouteMappers);
            if (this.IsOverrideTableRouteMappers == false)
            {
                routeMappers.AddRange(tableRouteMappers);
            }
            foreach (var routeMapper in routeMappers)
            {
                if (routeMapper.IsMapping(formRouteData, this))
                {
                    return(true);
                }
            }
            return(false);
        }