I have a class :
public class TestClass
{
public string value1 {get; set;}
public string value2 {get; set;}
public string value3 {get; set;}
public string value4 {get; set;}
}
and the database :
Database - Test
id code value1 value2 value3 value4
-- ---- ------ ------ ------ ------
1 1000 xxxxx xxxxx xxxxx xxxxx
2 1000 yyyyy ..... ..... .....
3 1000 yyyy3 ..... ..... .....
4 1000 yyyy4
5 2000 yyyy5
6 2000 yyyy6
7 3000 yyyy7
8 3000 yyyy8
9 4000 yyyy9
10 4000 y9999
This is gonna be 4 key and 4 list of TestClass. string is a code and rest is testClass list.
I wanna map this to this dictionary: If Code is a same add it into list of TestClass.
Dictionary<string, List<TestClass>> testDic = new Dictionary<string, List<TestClass>>();
testDic = conn.Query("SELECT * FROM Test").ToDictionary(x=> x.????) ;
How to do it? I assume it is something like think but its not working?