Esempio n. 1
0
        public static Type GetScopeType(this RuleScope scope)
        {
            if (scope.IsMultiple())
            {
                throw new InvalidOperationException("The provided RuleScope enum value has more than one flag set.");
            }

            switch (scope)
            {
            case RuleScope.Model: return(typeof(Model));

            case RuleScope.Table: return(typeof(Table));

            case RuleScope.Measure: return(typeof(Measure));

            case RuleScope.Hierarchy: return(typeof(Hierarchy));

            case RuleScope.Level: return(typeof(Level));

            case RuleScope.Relationship: return(typeof(SingleColumnRelationship));

            case RuleScope.Perspective: return(typeof(Perspective));

            case RuleScope.Culture: return(typeof(Culture));

            case RuleScope.Partition: return(typeof(Partition));

            case RuleScope.ProviderDataSource: return(typeof(ProviderDataSource));

            case RuleScope.StructuredDataSource: return(typeof(StructuredDataSource));

            case RuleScope.DataColumn: return(typeof(DataColumn));

            case RuleScope.CalculatedColumn: return(typeof(CalculatedColumn));

            case RuleScope.CalculatedTable: return(typeof(CalculatedTable));

            case RuleScope.CalculatedTableColumn: return(typeof(CalculatedTableColumn));

            case RuleScope.KPI: return(typeof(KPI));

            case RuleScope.Variation: return(typeof(Variation));

            case RuleScope.NamedExpression: return(typeof(NamedExpression));

            case RuleScope.ModelRole: return(typeof(ModelRole));

            case RuleScope.CalculationGroup: return(typeof(CalculationGroupTable));

            //case RuleScope.CalculationGroupAttribute: return typeof(CalculationGroupAttribute);
            case RuleScope.CalculationItem: return(typeof(CalculationItem));

            case RuleScope.TablePermission: return(typeof(TablePermission));

            case RuleScope.ModelRoleMember: return(typeof(ModelRoleMember));

            default:
                throw new InvalidOperationException("Unknown scope type");
            }
        }
Esempio n. 2
0
        public static string GetTypeName(this RuleScope scope)
        {
            if (scope.IsMultiple())
            {
                throw new InvalidOperationException("The provided RuleScope enum value has more than one flag set.");
            }

            var x = scope.ToString().SplitCamelCase();

            if (scope == RuleScope.Hierarchy)
            {
                x = "Hierarchies";
            }
            else if (scope != RuleScope.Model)
            {
                x += "s";
            }
            return(x);
        }