Naming Conventions for Tables and Columns with the Mapper and LINQ

Description

It would be nice to be able to configure the Mapper with naming conventions for tables and columns. Since the Mapper and LINQ components share configuration now for how to map objects, these conventions would apply to the LINQ API as well. This would help minimize the amount of setup/configuration needed to use these components when developers are following a well-defined pattern for naming their tables and columns. Some examples that I think should some out of the box:

  • Pascal Case to Underscores: UserCredentials class -> User_Credentials table, VideoId property -> Video_Id column name

  • ToLowerCase: UserCredentials class -> usercredentials table, VideoId property -> videoid column name

  • Combinations: like convert pascal case to underscore AND convert to lowercase. UserCredentials class -> user_credentials table, VideoId property => video_id column name

Naming conventions should be able to be defined globally, and column names should be configurable separate from table names. Their should also be some way to order them (whether that's in the order they're registered in the configuration or some other way) so that developers can control in which order the conventions are applied.

Environment

None

Activity

Show:
Alex Popescu
February 11, 2015, 5:35 PM

I think this is a great idea, but I'd suggest waiting for a user confirmation that it's needed.

Jorge Bay Gondra
February 11, 2015, 8:46 PM

I think it will significantly decrease the amount of mapping configuration required and also helps users to enforce conventions. This conventions can be overridden by current table and column definitions (if specified).

About "Pascal Case to Underscore": OK.
About "ToLowerCase", I think it can be replaced by "CaseSensitive" convention, as C* identifiers are case insensitive by default (actually lower cased).

Assignee

Unassigned

Reporter

Luke Tillman

Labels

PM Priority

None

Fix versions

None

External issue ID

None

Doc Impact

None

Reviewer

None

Pull Request

None

Epic Link

None

Sprint

C# P-NEXT

Pull Requests

None

Size

S

Components

Priority

Major