That can't be modeled cleanly in dapper currently; you might be able to do something with the non-generic API and then applying the bindings manually. Or maybe just wrap a dynamic:
class Model {
private dynamic obj;
public int Id { get { return obj.Id; } set { obj.Id = value; } }
public string Title { get { return obj.Title; } set { obj.Title = value; } }
public object this[string key] {
get { return ((IDictionary<string,object>)obj)[key]; }
set { ((IDictionary<string,object>)obj)[key] = value; }
}
}
You can get a dynamic
/ IDictionary<string,object>
by using Query
without specifying a generic parameter.