When working with Entity Framework, is it possible to force generated entity classes to be Pascal case?

后端 未结 3 1444
一生所求
一生所求 2021-01-16 20:54

The database I\'m working against has table names such as \"table_name\". That\'s fine, but I\'d like to generate classes in the format \"TableName\" to work with in C#, Pas

3条回答
  •  不要未来只要你来
    2021-01-16 21:25

    some_class > SomeClass
    didn't work for me, instead I got:
    some_class > Someclass

    To fix it I moved
    previousCharWasUpper = false;
    a few lines up. It's near the end of the old code block.

            else
            {
                if (Char.IsDigit(character))
                {
                    sb.Append(character);
    
                    previousCharWasUpper = false;
                    lastOperationWasToLower = false;
                }
                else if(!replaceUnderscores)
                {
                    if(character == '_')
                    {
                        sb.Append(character);
                    }
                }
            }
    

    Changed to:

            else
            {
                previousCharWasUpper = false;
    
                if (Char.IsDigit(character))
                {
                    sb.Append(character);
    
                    lastOperationWasToLower = false;
                }
                else if(!replaceUnderscores)
                {
                    if(character == '_')
                    {
                        sb.Append(character);
                    }
                }
            }
    

提交回复
热议问题