I have an object that has a property of type KeyValuePair.
I would like to read some data from the database and save the results in this field of type KeyValuePair.
myObject.KeyValuePairs = ctx.ExecuteQuery<KeyValuePair<String, int>>
("Select " +
"[" + q.Name + "] As [Key]" +
", Count([" + q.Name + "]) As [Value] From SomeTable" +
" Group By [" + q.Name + "]").ToList();
myObject.KeyValuePairs is an List<KeyValuePair<String, int>>
When I try to read the entries, I get the following exception:
The type "System.Collections.Generic.KeyValuePair`2 [System.String, System.Int32]" must declare a default constructor (without parameters) so that it can be built during display.
I have a default constructor in the class, but this does not fix the problem. It seems like he does not know how to create a KeyValuePair object. Does it have a default constructor? Confused ..
thank
user338195
source
share