/// <summary> /// Processes the type if it's a DTO /// </summary> /// <param name="type">The type.</param> private void ProcessDto(Type type) { DtoAttribute dtoAttribute = AttributeUtil.GetAttributeFrom <DtoAttribute>(type); if (dtoAttribute != null) { Type entityType = null; if (dtoAttribute.EntityType != null) { entityType = dtoAttribute.EntityType; } else { string entityName = dtoAttribute.EntityName; if (string.IsNullOrEmpty(entityName)) { entityName = this.GetEntityName(type.Name); } entityType = TypesManager.ResolveType(entityName); if (entityType == null) { if (this.typeMetatables.ContainsKey(entityName.ToLower())) { entityName = this.typeMetatables[entityName.ToLower()].FullName; entityType = TypesManager.ResolveType(entityName); } } } if (entityType != null) { IMetamodelEntity metaEntity = this.Parent.MetamodelManager.RegisterEntity(entityType, type); if (this.Metatables.ContainsKey(entityType.FullName)) { MetaPersistentType metaType = this.Metatables[entityType.FullName]; Dictionary <MetaColumn, MetaMember> mapColumns = new Dictionary <MetaColumn, MetaMember>(); foreach (MetaMember member in metaType.Members) { MetaPrimitiveMember primitiveMember = member as MetaPrimitiveMember; if (primitiveMember != null) { mapColumns.Add(primitiveMember.Column, member); } } MetaTable metaTable = metaType.Table; foreach (MetaColumn metaColumn in metaTable.Columns) { MetaMember member = mapColumns[metaColumn]; metaEntity.AddField(member.Name, metaColumn.IsPrimaryKey, !metaColumn.IsPrimaryKey); } } } } }
/// <summary> /// Processes a type if its a BO /// </summary> /// <param name="type">The type.</param> /// <returns></returns> private void ProcessBO(Type type, Dictionary <string, Type> dtoMap) { BOAttribute boAttribute = AttributeUtil.GetAttributeFrom <BOAttribute>(type); if (boAttribute == null) { return; } if (boAttribute.DtoType != null) { this.Parent.BOManager.AddBOType(boAttribute.DtoType, type); return; } string name = string.IsNullOrEmpty(boAttribute.Name) ? type.Name : boAttribute.Name; if (name.IndexOf('.') > -1) { Type dtoType = TypesManager.ResolveType(name); if (dtoType != null) { this.Parent.BOManager.AddBOType(dtoType, type); } return; } if (dtoMap.ContainsKey(name)) { this.Parent.BOManager.AddBOType(dtoMap[name], type); return; } string testname = this.DtoPreffix + name + this.DtoSuffix; if (dtoMap.ContainsKey(testname)) { this.Parent.BOManager.AddBOType(dtoMap[testname], type); return; } testname = name; testname = this.RemovePreffix(testname, this.BOPreffix); testname = this.RemoveSuffix(testname, this.BOSuffix); if (dtoMap.ContainsKey(testname)) { this.Parent.BOManager.AddBOType(dtoMap[testname], type); return; } testname = this.DtoPreffix + testname + this.DtoSuffix; if (dtoMap.ContainsKey(testname)) { this.Parent.BOManager.AddBOType(dtoMap[testname], type); return; } }
/// <summary> /// Determines whether the specified type is filter. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> private bool IsFilter(Type type) { return(AttributeUtil.GetAttributeFrom <FilterAttribute>(type) != null); }
/// <summary> /// Determines whether the specified type is bo. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> private bool IsBO(Type type) { return(AttributeUtil.GetAttributeFrom <BOAttribute>(type) != null); }
/// <summary> /// Determines whether the specified type is dto. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> private bool IsDto(Type type) { return(AttributeUtil.GetAttributeFrom <DtoAttribute>(type) != null); }