public BaseNamespaceMetadata MapUp() { BaseNamespaceMetadata NamespaceMetadataDTO = new BaseNamespaceMetadata(); NamespaceMetadataDTO.NamespaceName = m_NamespaceName; if (m_Types != null) { List <BaseTypeMetadata> TypesMetadataDTO = new List <BaseTypeMetadata>(); foreach (TypeMetadata metadata in m_Types) { BaseTypeMetadata baseTypeMetadata; if (BaseTypeMetadata.TypeDictionary.ContainsKey(metadata.m_typeName)) { baseTypeMetadata = BaseTypeMetadata.TypeDictionary[metadata.m_typeName]; } else { baseTypeMetadata = metadata.MapUp(); } TypesMetadataDTO.Add(baseTypeMetadata); } NamespaceMetadataDTO.Types = TypesMetadataDTO; } return(NamespaceMetadataDTO); }
public NamespaceMetadata MapUp(BaseNamespaceMetadata model) { NamespaceMetadata namespaceModel = new NamespaceMetadata(); namespaceModel.Name = model.Name; Type type = model.GetType(); PropertyInfo typesProperty = type.GetProperty("Types", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); List <BaseTypeMetadata> types = (List <BaseTypeMetadata>)HelperClass.ConvertList(typeof(BaseTypeMetadata), (IList)typesProperty?.GetValue(model)); if (types != null) { namespaceModel.Types = types.Select(n => TypeModelMapper.EmitType(n)).ToList(); } return(namespaceModel); }
public static BaseNamespaceMetadata MapToBase(DBNamespaceModel namespaceMetadata) { var m_NamespaceName = namespaceMetadata.NamespaceName; foreach (var type in namespaceMetadata.TypesL) { Dictionares.TypeDictonaryToDTG[type] = DBTypeMapper.MapToBase(type); } var m_Types = from type in namespaceMetadata.TypesL orderby type.TypeName select DBTypeMapper.fillType(Dictionares.TypeDictonaryToDTG[type], type); BaseNamespaceMetadata namespaceModel = new BaseNamespaceMetadata { NamespaceName = m_NamespaceName, Types = m_Types }; return(namespaceModel); }
public NamespaceMetadata(BaseNamespaceMetadata namespaceMetadata) { m_NamespaceName = namespaceMetadata.NamespaceName; List <TypeMetadata> types = new List <TypeMetadata>(); foreach (BaseTypeMetadata metadata in namespaceMetadata.Types) { TypeMetadata type; if (TypeMetadata.m_typesMetadata.ContainsKey(metadata.TypeName)) { type = TypeMetadata.m_typesMetadata[metadata.TypeName]; } else { type = new TypeMetadata(metadata); } types.Add(type); } m_Types = types; }
public static DBNamespaceModel MapToDB(BaseNamespaceMetadata namespaceMetadata) { var m_NamespaceName = namespaceMetadata.NamespaceName; foreach (var type in namespaceMetadata.Types) { Dictionares.TypeDictonaryToDatabase[type] = DBTypeMapper.MapToDB(type); } var m_Types = from type in namespaceMetadata.Types orderby type.TypeName select DBTypeMapper.FillTypeDatabase(Dictionares.TypeDictonaryToDatabase[type], type); foreach (var t in m_Types) { t.NamespaceName = m_NamespaceName; } DBNamespaceModel namespaceModel = new DBNamespaceModel { NamespaceName = m_NamespaceName, Types = m_Types }; return(namespaceModel); }
public XMLNamespaceModel(BaseNamespaceMetadata namespaceBase) { NamespaceName = namespaceBase.NamespaceName; Types = namespaceBase.Types?.Select(t => XMLTypeModel.GetOrAdd(t)); }