If I have a value stored in a column in the db, and use EF to get it, is there a recommended way to formatting it when retrieving it?
For example, I store 6 digits in a string “123456”, and every time the value is retrieved, it should be returned as “12˚34’56”.
When stored, it should just be the digits again.
Currently, I’m doing it straight in the linq-query, but I’m not sure that is the best way. I do not want to change anything in the db.
EF doesn’t have any formatting options. That is task for your application logic. So either add custom non mapped property to your entity and let it return formatted value from mapped integer property or use custom query projection as you probably do at the moment.