Beispiel #1
0
        public SerializableType(TypeDTG type)
        {
            DictionaryOfTypes.Instance.RegisterType(type.Name, this);

            Name             = type.Name;
            MetadataName     = type.MetadataName;
            SernamespaceName = type.SernamespaceName;
            if (type.GenericArguments != null)
            {
                GenericArguments = type.GenericArguments?.Select(t => SerializableType.LoadType(t)).ToList();
            }
            if (type.NestedTypes != null)
            {
                NestedTypes = type.NestedTypes?.Select(nt => SerializableType.LoadType(nt)).ToList();
            }
            if (type.Interfaces != null)
            {
                Interfaces = type.Interfaces?.Select(i => SerializableType.LoadType(i)).ToList();
            }


            if (type.SerMethods != null)
            {
                SerMethods = type.SerMethods?.Select(m => new SerializableMethod(m)).ToList();
            }
            if (type.SerConstructors != null)
            {
                SerConstructors = type.SerConstructors?.Select(c => new SerializableMethod(c)).ToList();
            }
            if (type.SerProperties != null)
            {
                SerProperties = type.SerProperties?.Select(p => new SerializableProperty(p)).ToList();
            }
        }
Beispiel #2
0
 public static SerializableType LoadType(TypeDTG type)
 {
     if (type == null)
     {
         return(null);
     }
     return(DictionaryOfTypes.Instance.GetType(type.Name) ?? new SerializableType(type));
 }
Beispiel #3
0
 public static TypeDb LoadType(TypeDTG type)
 {
     if (type == null)
     {
         return(null);
     }
     return(DictionaryOfTypes.Instance.GetType(type.Name) ?? new TypeDb(type));
 }
Beispiel #4
0
 public TypeMetadata(TypeDTG type)
 {
     Name = type.Name;
     namespaceName = type.SernamespaceName;
     DictionaryOfTypes.Instance.RegisterType(Name, this);
     MetadataName = type.MetadataName;
     GenericArguments = type.GenericArguments?.Select(LoadType).ToList();
     NestedTypes = type.NestedTypes?.Select(LoadType).ToList();
     Interfaces = type.Interfaces?.Select(LoadType).ToList();
     Methods = type.SerMethods?.Select(m => new MethodMetadata(m)).ToList();
     Constructors = type.SerConstructors?.Select(c => new MethodMetadata(c)).ToList();
     Properties = type.SerProperties?.Select(p => new PropertyMetadata(p)).ToList();
 }
Beispiel #5
0
 public TypeDb(TypeDTG type)
 {
     DictionaryOfTypes.Instance.RegisterType(type.Name, this);
     Name             = type.Name;
     MetadataName     = type.MetadataName;
     SernamespaceName = type.SernamespaceName;
     GenericArguments = type.GenericArguments?.Select(t => LoadType(t)).ToList();
     NestedTypes      = type.NestedTypes?.Select(n => LoadType(n)).ToList();
     Interfaces       = type.Interfaces?.Select(i => LoadType(i)).ToList();
     SerMethods       = type.SerMethods?.Select(m => new MethodDb(m)).ToList();
     SerConstructors  = type.SerConstructors?.Select(c => new MethodDb(c)).ToList();
     SerProperties    = type.SerProperties?.Select(p => new PropertyDb(p)).ToList();
 }
Beispiel #6
0
        private static TypeDTG TypeDtg(SerializableType typeModel)
        {
            TypeDTG typeDTG = new TypeDTG()
            {
                Name             = typeModel.Name,
                MetadataName     = typeModel.MetadataName,
                SernamespaceName = typeModel.SernamespaceName,
            };

            TypeDtgDictionary.Add(typeModel.Name, typeDTG);

            typeDTG.GenericArguments = typeModel.GenericArguments?.Select(LoadType).ToList();
            typeDTG.Interfaces       = typeModel.Interfaces?.Select(LoadType).ToList();
            typeDTG.NestedTypes      = typeModel.NestedTypes?.Select(LoadType).ToList();
            typeDTG.SerMethods       = typeModel.SerMethods?.Select(MethodDtg).ToList();
            typeDTG.SerConstructors  = typeModel.SerConstructors?.Select(MethodDtg).ToList();
            typeDTG.SerProperties    = typeModel.SerProperties?.Select(PropertyDtg).ToList();
            return(typeDTG);
        }
Beispiel #7
0
 public static TypeMetadata LoadType(TypeDTG type)
 {
     return DictionaryOfTypes.Instance.GetType(type.Name) ?? new TypeMetadata(type); 
 }