Beispiel #1
0
 private void AppendInnerToTopLevelType(IModelType type, CodeModel serviceClient)
 {
     if (type == null)
     {
         return;
     }
     CompositeTypeJvaf compositeType = type as CompositeTypeJvaf;
     SequenceType sequenceType = type as SequenceType;
     DictionaryType dictionaryType = type as DictionaryType;
     if (compositeType != null && !compositeType.IsResource)
     {
         compositeType.IsInnerModel = true;
     }
     else if (sequenceType != null)
     {
         AppendInnerToTopLevelType(sequenceType.ElementType, serviceClient);
     }
     else if (dictionaryType != null)
     {
         AppendInnerToTopLevelType(dictionaryType.ValueType, serviceClient);
     }
 }
Beispiel #2
0
        private void AppendInnerToTopLevelType(IModelType type, CodeModel serviceClient)
        {
            if (type == null || removeInner.Contains(type.Name))
            {
                return;
            }
            CompositeTypeJvaf compositeType  = type as CompositeTypeJvaf;
            SequenceType      sequenceType   = type as SequenceType;
            DictionaryType    dictionaryType = type as DictionaryType;

            if (compositeType != null && !compositeType.IsResource)
            {
                compositeType.IsInnerModel = true;
                foreach (var t in serviceClient.ModelTypes)
                {
                    foreach (var p in t.Properties.Where(p => p.ModelType is CompositeTypeJvaf && !((CompositeTypeJvaf)p.ModelType).IsInnerModel))
                    {
                        if (p.ModelTypeName.EqualsIgnoreCase(compositeType.Name) ||
                            (p.ModelType is SequenceType && ((SequenceType)p.ModelType).ElementType.Name.EqualsIgnoreCase(compositeType.Name)) ||
                            (p.ModelType is DictionaryType && ((DictionaryType)p.ModelType).ValueType.Name.EqualsIgnoreCase(compositeType.Name)))
                        {
                            AppendInnerToTopLevelType(t, serviceClient);
                            break;
                        }
                    }
                }
            }
            else if (sequenceType != null)
            {
                AppendInnerToTopLevelType(sequenceType.ElementType, serviceClient);
            }
            else if (dictionaryType != null)
            {
                AppendInnerToTopLevelType(dictionaryType.ValueType, serviceClient);
            }
        }