Last week, I used Dapper instead of NHibernate to perform a simple processing on a table in our Oracle database. Since this is an ancient table, th...
For further actions, you may consider blocking this person and/or reporting abuse
I do prefer to do it slightly different by keeping classes clean. This code could still break if someone changes alias and keeps description attribute untouched.
You can assign correct aliases by using
nameof(Class.PropertyName)within your query string. This guarantees that column names are mapped correctly and makes refactoring so much easier in case you want to change a property name.Then your class can stay as is.
🙂
Yes. I also don't think it's really worth it, especially since I only use Dapper for small conversion application. But it was fun to try new things.
By the way, I love the
nameof(Class.PropertyName)thing. Thanks.Might be an overkill, yep.
A few days ago I had to do quite a big refactoring and queries were constructed exactly like this, refactoring was a breeze 🙂
Cheers!