I have a very similar question to Dapper-dot-net "no column name", but the answer there is not getting me where I need.
I\'m writing a web interface and us
The issue of non-trivial bindings keeps coming up; it came up most recently here: http://code.google.com/p/dapper-dot-net/issues/detail?id=108
My suggestion there stands, although I haven't had time to code it yet. I propose a static event that you can choose to handle, and apply whatever esoteric mappings you want, i.e.
SqlMapper.ColumnBind += (sender, args) {
int colIndex = args.ColumnIndex;
Type type = args.TargetType;
MemberInfo member = // ... Entirely up to you to define logic
args.Member = member;
};
The above is entirely theoretical, but would it meet your needs?
Note: if ColumnBind
was not subscribed, it would just do normal basic name mapping as normal. Thoughts?
(note: it could also be a single event invoke per type, rather than per-column; that might be more efficient, as the subscriber will call GetProperties
etc less often)