예제 #1
0
        public static PropertyRulePack GetPropertyRules(Lite <RoleEntity> role, TypeEntity typeEntity)
        {
            var result = new PropertyRulePack {
                Role = role, Type = typeEntity
            };

            cache.GetRules(result, PropertyRouteLogic.RetrieveOrGenerateProperties(typeEntity));

            var coercer = PropertyCoercer.Instance.GetCoerceValue(role);

            result.Rules.ForEach(r => r.CoercedValues = EnumExtensions.GetValues <PropertyAllowed>()
                                                        .Where(a => !coercer(PropertyRouteEntity.ToPropertyRouteFunc(r.Resource), a).Equals(a))
                                                        .ToArray());

            return(result);
        }
예제 #2
0
 static PropertyRoute ToPropertyRouteImplementation(PropertyRouteEntity route)
 {
     return(PropertyRoute.Parse(TypeLogic.EntityToType[route.RootType], route.Path));
 }
예제 #3
0
 public static bool IsPropertyRoute(this PropertyRouteEntity prdn, PropertyRoute pr)
 {
     return(IsPropertyRouteExpression.Evaluate(prdn, pr));
 }
예제 #4
0
 static PropertyRoute ToPropertyRouteImplementation(PropertyRouteEntity route)
 {
     return(PropertyRoute.Parse(TypeLogic.EntityToType.GetOrThrow(route.RootType), route.Path));
 }
예제 #5
0
 public static bool IsPropertyRoute(this PropertyRouteEntity prdn, PropertyRoute pr) =>
 As.Expression(() => prdn.RootType == pr.RootType.ToTypeEntity() && prdn.Path == pr.PropertyString());
예제 #6
0
 public string ParentType(PropertyRouteEntity pr)
 {
     return(pr.ToPropertyRoute().Parent.Type.Name);
 }
예제 #7
0
 public static PropertyRoute ToPropertyRoute(this PropertyRouteEntity route)
 {
     return(PropertyRoute.Parse(TypeLogic.DnToType[route.RootType], route.Path));
 }
예제 #8
0
 public string RouteTypeName([Required, FromBody] PropertyRouteEntity pr)
 {
     return(pr.ToPropertyRoute().Type.Name);
 }