public static List<PropertyRouteEntity> RetrieveOrGenerateProperties(TypeEntity typeEntity)
        {
            var retrieve = Database.Query<PropertyRouteEntity>().Where(f => f.RootType == typeEntity).ToDictionary(a => a.Path);
            var generate = GenerateProperties(TypeLogic.DnToType[typeEntity], typeEntity).ToDictionary(a => a.Path);

            return generate.Select(kvp => retrieve.TryGetC(kvp.Key)?.Do(pi => pi.Route = kvp.Value.Route) ?? kvp.Value).ToList();
        }
 public static List<PropertyRouteEntity> GenerateProperties(Type type, TypeEntity typeEntity)
 {
     return PropertyRoute.GenerateRoutes(type).Select(pr =>
         new PropertyRouteEntity
         {
             Route = pr,
             RootType = typeEntity,
             Path = pr.PropertyString()
         }).ToList();
 }
Exemple #3
0
 public static TypeEntity ToTypeEntity(this Type type)
 {
     return(TypeEntity.ToTypeDNFunc(type));
 }
        public static List<QueryEntity> GetTypeQueries(TypeEntity typeEntity)
        {
            Type type = TypeLogic.GetType(typeEntity.CleanName);

            return DynamicQueryManager.Current.GetTypeQueries(type).Keys.Select(GetQueryEntity).ToList();
        }
Exemple #5
0
 public static Type ToType(this TypeEntity type)
 {
     return(TypeEntity.ToTypeFunc(type));
 }
 public List<string> GetLiteralsFromDataObjectProvider(TypeEntity type)
 {
     return Return(MethodInfo.GetCurrentMethod(),
         () => SMSLogic.GetLiteralsFromDataObjectProvider(type.ToType()));
 }
 public OperationRulePack GetOperationRules(Lite<RoleEntity> role, TypeEntity typeEntity)
 {
     return Return(MethodInfo.GetCurrentMethod(),
       () => OperationAuthLogic.GetOperationRules(role, typeEntity));
 }
 public QueryRulePack GetQueryRules(Lite<RoleEntity> role, TypeEntity typeEntity)
 {
     return Return(MethodInfo.GetCurrentMethod(),
       () => QueryAuthLogic.GetQueryRules(role, typeEntity));
 }
 public static PropertyRouteEntity TryGetPropertyRouteEntity(TypeEntity entity, string path)
 {
     return Properties.Value.TryGetC(entity)?.TryGetC(path);
 }
        public TypeRuleBuilder(TypeAllowedRule rule)
        {
            this.allowed = new TypeAllowedBuilder(rule.Allowed.Fallback);
            this.conditions = rule.Allowed.Conditions.Select(c => new TypeConditionRuleBuilder(c.TypeCondition, c.Allowed)).ToMList();
            this.availableConditions = rule.AvailableConditions;
            this.allowedBase = rule.AllowedBase;
            this.resource = rule.Resource;

            this.properties = rule.Properties;
            this.operations = rule.Operations;
            this.queries = rule.Queries;

            this.RebindEvents();
        }