示例#1
0
        internal DataFragment FillEntities(EntityRule[] rules, IPersistEntity entity, DataIndicatorLookup dataIndicators, string prefix)
        {
            // todo: review the return logic;

            //
            if (entity == null)
            {
                return(null);
            }
            foreach (var entityRule in rules)
            {
                // it's probably safe to assume that if we are here then the whole schema is the same of the element we are using
                // regardless from _forceModelSchema settings; it would otherwise be complicated to consider which of the schemas to use of the
                // array of schemes of the parent ConceptTemplate.
                var filterType = GetExpressType(entity.Model.Metadata, entityRule.EntityName.ToUpper());
                if (filterType == null)
                {
                    continue;
                }
                if (!filterType.NonAbstractSubTypes.Contains(entity.ExpressType))
                {
                    continue;
                }

                if (entityRule.References != null)
                {
                    // need to resolve reference
                    if (string.IsNullOrEmpty(entityRule.References.Template?.@ref))
                    {
                        continue;
                    }
                    var tPrefix = prefix;
                    // Debug.Print(@"Ref: {0} on {1} ({2})", entityRule.References.Template.@ref, entity.EntityLabel, entity.GetType().Name);
                    var refTemplate = Mvd.GetConceptTemplate(entityRule.References.Template.@ref);
                    if (!string.IsNullOrEmpty(entityRule.References.IdPrefix))
                    {
                        tPrefix += entityRule.References.IdPrefix;
                    }
                    // todo: xxx this is wrong! what about the following rules?
                    var t = GetAttributes(refTemplate, entity, dataIndicators, tPrefix);
                    return(t);
                }
                else if (entityRule.AttributeRules != null)
                {
                    // todo: xxx this is wrong! what about the following rules?
                    // rules nested directly
                    return(GetAttributes(entityRule.AttributeRules.AttributeRule, entity, dataIndicators, prefix));
                }
            }
            return(null);
        }
示例#2
0
 /// <summary>
 /// Accessof to nested Concepts
 /// </summary>
 /// <returns></returns>
 public IEnumerable <Concept> GetAllConcepts()
 {
     return(Mvd.GetAllConcepts());
 }
示例#3
0
 /// <summary>
 /// Accessof to nested ConceptTemplates
 /// </summary>
 /// <returns></returns>
 public IEnumerable <ConceptTemplate> GetAllConceptTemplates()
 {
     return(Mvd.GetAllConceptTemplates());
 }