Beispiel #1
0
        private void BuildDictionary(
            DataType dataType,
            Type type,
            TypeDescription typeDescription,
            bool inputGraph,
            IEnumerable <Type> ancestors,
            MemberDescription memberDescription)
        {
            var types = type.GetGenericDictionaryTypes();

            dataType.IsDictionary    = true;
            dataType.Comments        = memberDescription.WhenNotNull(x => x.Comments).OtherwiseDefault() ?? dataType.Comments;
            dataType.DictionaryEntry = new DictionaryEntry
            {
                KeyName = memberDescription.WhenNotNull(x => x.DictionaryEntry.KeyName).OtherwiseDefault() ??
                          typeDescription.WhenNotNull(x => x.DictionaryEntry.KeyName).OtherwiseDefault(),
                KeyComments = memberDescription.WhenNotNull(x => x.DictionaryEntry.KeyComments).OtherwiseDefault() ??
                              typeDescription.WhenNotNull(x => x.DictionaryEntry.KeyComments).OtherwiseDefault(),
                KeyType       = BuildGraph(dataType, types.Key, inputGraph, ancestors),
                ValueComments = memberDescription.WhenNotNull(x => x.DictionaryEntry.ValueComments).OtherwiseDefault() ??
                                typeDescription.WhenNotNull(x => x.DictionaryEntry.ValueComments).OtherwiseDefault(),
                ValueType = BuildGraph(dataType, types.Value, inputGraph, ancestors)
            };
        }
Beispiel #2
0
        private void BuildArray(
            DataType dataType,
            Type type,
            TypeDescription typeDescription,
            bool inputGraph,
            IEnumerable <Type> ancestors,
            MemberDescription memberDescription)
        {
            dataType.IsArray  = true;
            dataType.Comments = memberDescription.WhenNotNull(x => x.Comments).OtherwiseDefault() ?? dataType.Comments;
            var itemType = BuildGraph(dataType, type.GetListElementType(), inputGraph, ancestors);

            dataType.ArrayItem = new ArrayItem
            {
                Name = memberDescription.WhenNotNull(x => x.ArrayItem.Name).OtherwiseDefault() ??
                       typeDescription.WhenNotNull(x => x.ArrayItem.Name).OtherwiseDefault() ?? itemType.Name,
                Comments = memberDescription.WhenNotNull(x => x.ArrayItem.Comments).OtherwiseDefault() ??
                           typeDescription.ArrayItem.WhenNotNull(x => x.Comments).OtherwiseDefault(),
                Type = itemType
            };
        }
 private void BuildDictionary(
     DataType dataType,
     Type type,
     TypeDescription typeDescription,
     bool inputGraph,
     IEnumerable<Type> ancestors, 
     MemberDescription memberDescription)
 {
     var types = type.GetGenericDictionaryTypes();
     dataType.IsDictionary = true;
     dataType.Comments = memberDescription.WhenNotNull(x => x.Comments).OtherwiseDefault() ?? dataType.Comments;
     dataType.DictionaryEntry = new DictionaryEntry
     {
         KeyName = memberDescription.WhenNotNull(x => x.DictionaryEntry.KeyName).OtherwiseDefault() ??
                   typeDescription.WhenNotNull(x => x.DictionaryEntry.KeyName).OtherwiseDefault(),
         KeyComments = memberDescription.WhenNotNull(x => x.DictionaryEntry.KeyComments).OtherwiseDefault() ??
                       typeDescription.WhenNotNull(x => x.DictionaryEntry.KeyComments).OtherwiseDefault(),
         KeyType = BuildGraph(dataType, types.Key, inputGraph, ancestors),
         ValueComments = memberDescription.WhenNotNull(x => x.DictionaryEntry.ValueComments).OtherwiseDefault() ??
                         typeDescription.WhenNotNull(x => x.DictionaryEntry.ValueComments).OtherwiseDefault(),
         ValueType = BuildGraph(dataType, types.Value, inputGraph, ancestors)
     };
 }
 private void BuildArray(
     DataType dataType,
     Type type,
     TypeDescription typeDescription,
     bool inputGraph,
     IEnumerable<Type> ancestors,
     MemberDescription memberDescription)
 {
     dataType.IsArray = true;
     dataType.Comments = memberDescription.WhenNotNull(x => x.Comments).OtherwiseDefault() ?? dataType.Comments;
     var itemType = BuildGraph(dataType, type.GetListElementType(), inputGraph, ancestors);
     dataType.ArrayItem = new ArrayItem
     {
         Name = memberDescription.WhenNotNull(x => x.ArrayItem.Name).OtherwiseDefault() ??
                typeDescription.WhenNotNull(x => x.ArrayItem.Name).OtherwiseDefault() ?? itemType.Name,
         Comments = memberDescription.WhenNotNull(x => x.ArrayItem.Comments).OtherwiseDefault() ??
                    typeDescription.ArrayItem.WhenNotNull(x => x.Comments).OtherwiseDefault(),
         Type = itemType
     };
 }