Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加全局转换实体属性名方法 #60

Merged
merged 1 commit into from
Jun 13, 2019
Merged

Conversation

stulzq
Copy link
Member

@stulzq stulzq commented Jun 13, 2019

用法

new FreeSql.FreeSqlBuilder()
        .UseEntityPropertyNameConvert(StringConvertType.PascalCaseToUnderscore)
	.Build());

现在添加了6种转换类型

public enum StringConvertType
{
    /// <summary>
    /// 不进行任何处理
    /// </summary>
    None = 0,

    /// <summary>
    /// 将帕斯卡命名字符串转换为下划线分隔字符串
    /// <para></para>
    /// BigApple -> Big_Apple
    /// </summary>
    PascalCaseToUnderscore,

    /// <summary>
    /// 将帕斯卡命名字符串转换为下划线分隔字符串,且转换为全大写
    /// <para></para>
    /// BigApple -> BIG_APPLE
    /// </summary>
    PascalCaseToUnderscoreWithUpper,

    /// <summary>
    /// 将帕斯卡命名字符串转换为下划线分隔字符串,且转换为全小写
    /// <para></para>
    /// BigApple -> big_apple
    /// </summary>
    PascalCaseToUnderscoreWithLower,

    /// <summary>
    /// 将字符串转换为大写
    /// <para></para>
    /// BigApple -> BIGAPPLE
    /// </summary>
    Upper,

    /// <summary>
    /// 将字符串转换为小写
    /// <para></para>
    /// BigApple -> bigapple
    /// </summary>
    Lower
}

注意:

  • 只会转换属性名,不会转换类名
  • 如果属性设置 [Column] 特性且设置了Name,那么该转换方法将不会覆盖这个值

@2881099 2881099 merged commit ab658ca into dotnetcore:master Jun 13, 2019
2881099 pushed a commit that referenced this pull request Jun 13, 2019
- 增加 FreeSqlBuilder UseEntityPropertyNameConvert() 全局转换实体属性名方法 #60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants