private TableDrivedEntityDTO ToTableDrivedEntityDTO(TableDrivedEntity item, EntityColumnInfoType columnInfoType, EntityRelationshipInfoType relationshipInfoType)
        {
            //var cachedItem = CacheManager.GetCacheManager().GetCachedItem(CacheItemType.Entity, item.ID.ToString(), columnInfoType.ToString(), relationshipInfoType.ToString());
            //if (cachedItem != null)
            //    return (cachedItem as TableDrivedEntityDTO);
            TableDrivedEntityDTO result = new TableDrivedEntityDTO();

            result.Name      = item.Name;
            result.ID        = item.ID;
            result.TableID   = item.TableID;
            result.TableName = item.Table.Name;
            //    result.Schema = item.Table.DBSchema.Name;
            result.EntityListViewID = item.EntityListViewID ?? 0;
            result.DatabaseID       = item.Table.DBSchema.DatabaseInformationID;
            result.DatabaseName     = item.Table.DBSchema.DatabaseInformation.Name;
            result.RelatedSchemaID  = item.Table.DBSchemaID;
            result.RelatedSchema    = item.Table.DBSchema.Name;
            result.ServerID         = item.Table.DBSchema.DatabaseInformation.DBServerID;
            result.Alias            = item.Alias;
            result.Criteria         = item.Criteria;
            //result.SecurityObjectID = item.SecurityObjectID.Value;

            //if (result.UnionTypeEntities == "")
            //    if (item.Relationship.Any(x => (x.RelationshipType == null && x.Relationship2 != null && x.TableDrivedEntity != x.TableDrivedEntity1 && !x.RelationshipColumns.All(y => y.Column.PrimaryKey == true))
            //        || (x.Relationship2 == null && x.TableDrivedEntity != x.TableDrivedEntity1 && !x.RelationshipColumns.All(y => y.Column1.PrimaryKey == true))))
            //        result.UnionTypeEntities = "Choose UnionType";

            result.BatchDataEntry       = item.BatchDataEntry;
            result.IsAssociative        = item.IsAssociative;
            result.IsDataReference      = item.IsDataReference;
            result.IsStructurReferencee = item.IsStructurReferencee;
            BizColumn bizColumn = new BizColumn();

            if (columnInfoType == EntityColumnInfoType.WithSimpleColumns)
            {
                result.Columns = bizColumn.GetColumns(item, true);
            }
            else if (columnInfoType == EntityColumnInfoType.WithFullColumns)
            {
                result.Columns = bizColumn.GetColumns(item, false);
            }
            if (relationshipInfoType == EntityRelationshipInfoType.WithRelationships)
            {
                BizISARelationship   bizISARelationship   = new BizISARelationship();
                BizUnionRelationship bizUnionRelationship = new Paper_MetadataManagement.BizUnionRelationship();
                BizRelationship      bizRelationship      = new BizRelationship();
                foreach (var relationship in item.Relationship)
                {
                    var relationshipDTO = bizRelationship.ToRelationshipDTO(relationship);
                    result.Relationships.Add(relationshipDTO);
                    if (relationship.RelationshipType != null)
                    {
                        if (relationship.RelationshipType.OneToManyRelationshipType != null)
                        {
                            result.OneToManyRelationships.Add(bizRelationship.ToOneToManyRelationship(relationship.RelationshipType.OneToManyRelationshipType, relationshipDTO));
                        }
                        else if (relationship.RelationshipType.ManyToOneRelationshipType != null)
                        {
                            result.ManyToOneRelationships.Add(bizRelationship.ToManyToOneRelationshipDTO(relationship.RelationshipType.ManyToOneRelationshipType, relationshipDTO));
                        }
                        else if (relationship.RelationshipType.ImplicitOneToOneRelationshipType != null)
                        {
                            result.ImplicitOneToOneRelationships.Add(bizRelationship.ToImplicitOneToOneRelationshipDTO(relationship.RelationshipType.ImplicitOneToOneRelationshipType, relationshipDTO));
                        }
                        else if (relationship.RelationshipType.ExplicitOneToOneRelationshipType != null)
                        {
                            result.ExplicitOneToOneRelationships.Add(bizRelationship.ToExplicitOneToOneRelationshipDTO(relationship.RelationshipType.ExplicitOneToOneRelationshipType, relationshipDTO));
                        }
                        else if (relationship.RelationshipType.SuperToSubRelationshipType != null)
                        {
                            result.SuperToSubRelationships.Add(bizISARelationship.ToSuperToSubRelationshipDTO(relationship.RelationshipType.SuperToSubRelationshipType, relationshipDTO));
                        }
                        else if (relationship.RelationshipType.SubToSuperRelationshipType != null)
                        {
                            result.SubToSuperRelationships.Add(bizISARelationship.ToSubToSuperRelationshipDTO(relationship.RelationshipType.SubToSuperRelationshipType, relationshipDTO));
                        }
                        else if (relationship.RelationshipType.UnionToSubUnionRelationshipType != null)
                        {
                            result.SuperUnionToSubUnionRelationships.Add(bizUnionRelationship.ToSuperUnionToSubUnionRelationshipDTO(relationship.RelationshipType.UnionToSubUnionRelationshipType, relationshipDTO));
                        }
                        else if (relationship.RelationshipType.SubUnionToUnionRelationshipType != null)
                        {
                            result.SubUnionToSuperUnionRelationships.Add(bizUnionRelationship.ToSubUnionToSuperUnionRelationshipDTO(relationship.RelationshipType.SubUnionToUnionRelationshipType, relationshipDTO));
                        }
                    }
                }
            }

            //CacheManager.GetCacheManager().AddCacheItem(result, CacheItemType.Entity, item.ID.ToString(), columnInfoType.ToString(), relationshipInfoType.ToString());
            return(result);
        }