3

I have a large existing database which has a convention where all the column names are prefixed with the de-pluralised tablename, e.g.

Tablename: addresses
Columns:
    addressId
    addressLine1
    addressLine2

Is there any configuration I can apply for a mapping (using the fluent API) where I can specify that all column names are prefixed with a string e.g. "address"? Otherwise I will need to define every single column mapping, which seems a bit of a pain.

What would be even better is if I could write a convention where the prefix is automatically set from the de-pluralised tablename, but I am aware that custom conventions are not supported at this point, so I guess this is even less feasible.

Tom Haigh
  • 57,217
  • 21
  • 114
  • 142
  • Don't use EF 4.2 tag. EF 4.2 is just bug fixed EF 4.1 with almost nothing new and it doesn't need its own tag. – Ladislav Mrnka Dec 15 '11 at 13:57
  • An old question, but not the first time I've landed here, so for anyone else looking for an EF6 solution, there's one here: http://stackoverflow.com/questions/40674883/add-column-name-convention-to-ef6-fluentapi/40677226 – jleach Nov 18 '16 at 13:13
  • You can write your own conventions "engine", it's not terribly hard. Here's how: http://sessionfactory.blogspot.com/2011/04/conventions-in-entity-framework-41.html – Diego Mijelshon Dec 08 '11 at 11:21

0 Answers0