Source/NFX/RelationalModel/RDBMSCompiler.cs
/// <summary>
/// Override to map a name from schema into the name that should be used in the output (i.e. real table name)
/// </summary>
Override to map a name from schema into the name that should be used in the output
Override to map a name from schema into the name that should be used in the output
public virtual void TransformEntityName(RDBMSEntity entity)
            {
                var name = entity.OriginalName;
                var parentName = entity.ParentEntity!=null ? "{0}_".Args(entity.ParentEntity.TransformedShortName) : string.Empty;
                if (entity.EntityType==RDBMSEntityType.PrimaryKey || entity.EntityType==RDBMSEntityType.Reference)
                {
                    var parentParentName = entity.ParentEntity!=null && entity.ParentEntity.ParentEntity!=null ? "{0}_".Args(entity.ParentEntity.ParentEntity.TransformedShortName) : string.Empty;
                    parentName = entity.ParentEntity.EntityType==RDBMSEntityType.Column ? parentParentName : parentName;
                }
                string result = entity.OriginalName;
                switch(entity.EntityType)
                {
                    case RDBMSEntityType.Table:       { result =  "tbl_" + name;    break; }
                    case RDBMSEntityType.Column:      { result =  name;             break; }
                    case RDBMSEntityType.Domain:      { result =  name;             break; }
                    case RDBMSEntityType.PrimaryKey:  { result =  "pk_"+parentName+name;  break; }
                    case RDBMSEntityType.Index:       { result =  "idx_"+parentName+name; break; }
                    case RDBMSEntityType.Trigger:     { result =  "trg_"+parentName+name; break; }
                    case RDBMSEntityType.View:        { result =  "viw_"+name;            break; }
                    case RDBMSEntityType.StoreProc:   { result =  "sp_"+name;             break; }
                    case RDBMSEntityType.CheckConstraint:  { result =  "cc_"+name;             break; }
                    case RDBMSEntityType.Reference:   { result =  "fk_"+parentName+name;  break; }
                }
                entity.TransformedName = result;
                entity.TransformedShortName = entity.OriginalShortName;
                if (entity.TransformedShortName.IsNullOrWhiteSpace())
                {
                    entity.TransformedShortName = entity.TransformedName;
                }
                if (NameCaseSensitivity==RelationalModel.NameCaseSensitivity.ToUpper)
                {
                    entity.TransformedName = entity.TransformedName.ToUpperInvariant();
                    entity.TransformedShortName = entity.TransformedShortName.ToUpperInvariant();
                }
                 else if (NameCaseSensitivity==RelationalModel.NameCaseSensitivity.ToLower)
                {
                    entity.TransformedName = entity.TransformedName.ToLowerInvariant();
                    entity.TransformedShortName = entity.TransformedShortName.ToLowerInvariant();
                }
            }
public virtual void TransformEntityName ( RDBMSEntity entity ) { var name = entity . OriginalName ; var parentName = entity . ParentEntity != null ? " " . Args ( entity . ParentEntity . TransformedShortName ) : string . Empty ; if ( entity . EntityType == RDBMSEntityType . PrimaryKey || entity . EntityType == RDBMSEntityType . Reference ) { var parentParentName = entity . ParentEntity != null && entity . ParentEntity . ParentEntity != null ? " " . Args ( entity . ParentEntity . ParentEntity . TransformedShortName ) : string . Empty ; parentName = entity . ParentEntity . EntityType == RDBMSEntityType . Column ? parentParentName : parentName ; } string result = entity . OriginalName ; switch ( entity . EntityType ) { case RDBMSEntityType . Table : { result = " " + name ; break ; } case RDBMSEntityType . Column : { result = name ; break ; } case RDBMSEntityType . Domain : { result = name ; break ; } case RDBMSEntityType . PrimaryKey : { result = " " + parentName + name ; break ; } case RDBMSEntityType . Index : { result = " " + parentName + name ; break ; } case RDBMSEntityType . Trigger : { result = " " + parentName + name ; break ; } case RDBMSEntityType . View : { result = " " + name ; break ; } case RDBMSEntityType . StoreProc : { result = " " + name ; break ; } case RDBMSEntityType . CheckConstraint : { result = " " + name ; break ; } case RDBMSEntityType . Reference : { result = " " + parentName + name ; break ; } } entity . TransformedName = result ; entity . TransformedShortName = entity . OriginalShortName ; if ( entity . TransformedShortName . IsNullOrWhiteSpace ( ) ) { entity . TransformedShortName = entity . TransformedName ; } if ( NameCaseSensitivity == RelationalModel . NameCaseSensitivity . ToUpper ) { entity . TransformedName = entity . TransformedName . ToUpperInvariant ( ) ; entity . TransformedShortName = entity . TransformedShortName . ToUpperInvariant ( ) ; } else if ( NameCaseSensitivity == RelationalModel . NameCaseSensitivity . ToLower ) { entity . TransformedName = entity . TransformedName . ToLowerInvariant ( ) ; entity . TransformedShortName = entity . TransformedShortName . ToLowerInvariant ( ) ; } }
Override to map a name from schema into the name that should be used in the output (i.e.
Override to map a name from schema into the name that should be used in the output ( i . e .
entity
RDBMSEntity