public override string GetParameterName(PropertyInfo propInfo, string columnName, string parameterName, bool doNotTranslate = false, DbKeyConstraint constraint = DbKeyConstraint.None)
        {
            if (string.IsNullOrEmpty(parameterName))
            {
                parameterName = (doNotTranslate ? string.Empty : "p_") + (columnName ?? propInfo.Name);
            }

            return(base.GetParameterName(null, null, parameterName, doNotTranslate, constraint));
        }
Beispiel #2
0
        /// <summary>
        /// Translates a name.
        /// </summary>
        protected virtual string TranslateName(Source source, Translation scope, string reflectionName, string configurationName, Case namingCase, DbKeyConstraint constraint, AffixPlacing idPlacing, params string[] affixes)
        {
            bool forceId;

            switch (constraint)
            {
            case DbKeyConstraint.PrimaryKey:
            case DbKeyConstraint.PrimaryForeignKey:
            case DbKeyConstraint.ForeignKey:
                forceId = scope != Translation.None && ForceIdOnKeyColumn;
                break;

            default:
                forceId = false;
                break;
            }

            return(TranslateName(source, scope, reflectionName, configurationName, namingCase, forceId, idPlacing, affixes));
        }
Beispiel #3
0
 /// <summary>
 /// Gets a field name.
 /// </summary>
 public virtual string GetFieldName(PropertyInfo propInfo, string fieldName, DbKeyConstraint constraint = DbKeyConstraint.None)
 {
     return(TranslateName(TextSource, Scope, propInfo?.Name, fieldName, FieldsCase, constraint, IdPlacing, IdText));
 }
Beispiel #4
0
 /// <summary>
 /// Gets a table column name.
 /// </summary>
 public virtual string GetColumnName(string tableName, PropertyInfo propInfo, string columnName, DbKeyConstraint constraint = DbKeyConstraint.None)
 {
     return(TranslateName(TextSource, Scope, propInfo.Name, columnName, FieldsCase, constraint, IdPlacing, IdText));
 }
Beispiel #5
0
 /// <summary>
 /// Gets a parameter name.
 /// </summary>
 public virtual string GetParameterName(PropertyInfo propInfo, string columnName, string parameterName, bool doNotTranslate = false, DbKeyConstraint constraint = DbKeyConstraint.None)
 {
     return(TranslateName(TextSource, doNotTranslate ? Translation.None : Scope, propInfo?.Name, parameterName ?? columnName, ParametersCase, constraint, IdPlacing, IdText));
 }