DapperLib / DapperAOT

Build time tools in the flavor of Dapper
Other
357 stars 19 forks source link

Support [Column] #36

Closed mgravell closed 9 months ago

mgravell commented 1 year ago

Currently we support names (parameter and column) via [DbValue], however there is also a well-known [System.ComponentModel.DataAnnotations.Schema.ColumnAttribute] that is commonly used.

I'm hesitant to use this blindly, because that would change existing behavior, so this should be triggered via a new UseColumnAttributeAttribute (yes, the naming is weird - see also XmlAttributeAttribute) which would apply at all levels (like most DapperAOT attributes):

See also https://stackoverflow.com/questions/77073286/can-dapper-mappings-be-automated-with-attributes

mgravell commented 12 months ago

See ElementMember.DbName; IMO to avoid confusion, if there is both an enabled [Column(...)] and a [DbValue(...)] providing a different name (we can ignore if they match), we should issue a warning but take the DbValue(...) version, i.e.

A column name is specified via both [DbValue] and [Column]; "Whatever" will be used