How can I configure Entity Framework to automatically trim values retrieved for specific columns mapped to char(N) fields?
问题 I'm working with a third-party database in which all text values are stored as char(n) . Some of these text values are primary keys, whereas others are just normal human-readable text. For the latter, I want retrieved values to be automatically trimmed. I know I can add Trim to all of my LINQ to Entities queries, but this is messy, unreliable and unmaintainable. I would like to somehow configure Entity Framework to automatically trim values retrieved from specific columns. However, I don't