public SqliteFieldTransferObject(FieldTransferObject field) : base(field) { }
private void ReadClass(Type type, ModelTransferObject model, List <ITransferObject> transferObjects) { Logger.Trace($"Reflection read type {type.Name} ({type.Namespace})"); if (type.BaseType != typeof(object) && type.BaseType != null) { model.BasedOn = this.Read(type.BaseType, transferObjects); } Dictionary <Type, string> genericMapping = new Dictionary <Type, string>(); if (type.IsGenericType) { model.IsGeneric = true; model.Generics.Clear(); foreach (Type argument in type.GenericTypeArguments) { string alias = genericMapping.Count > 1 ? $"T{genericMapping.Count}" : "T"; genericMapping.Add(argument, alias); model.Generics.Add(new GenericAliasTransferObject { Alias = alias, Type = this.Read(argument, transferObjects) }); } } model.IsInterface = type.IsInterface; model.IsAbstract = type.IsAbstract; foreach (Type interFace in type.GetInterfaces(false)) { model.Interfaces.Add(this.Read(interFace, transferObjects)); } FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); foreach (FieldInfo field in fields) { FieldTransferObject fieldTransferObject = new FieldTransferObject { Name = field.Name, Type = genericMapping.ContainsKey(field.FieldType) ? new TypeTransferObject { Name = genericMapping[field.FieldType] } : this.Read(field.FieldType, transferObjects) }; model.Fields.Add(fieldTransferObject); } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); foreach (PropertyInfo property in properties) { PropertyTransferObject propertyTransferObject = new PropertyTransferObject { Name = property.Name, Type = genericMapping.ContainsKey(property.PropertyType) ? new TypeTransferObject { Name = genericMapping[property.PropertyType] } : this.Read(property.PropertyType, transferObjects), CanRead = property.CanRead, CanWrite = property.CanWrite }; model.Properties.Add(propertyTransferObject); } }