Fetching data from database using dapper as a dynamic list.
ID | ATTR | ATTR_VALUE |
---|---|---|
1 | A | CAR |
1 | B | BUS |
1 | C | TRUCK |
2 | A | CAR |
2 | B | BUS |
2 | C | TRUCK |
I have tried mapping above dynamic data to custom list using my own custom data mapping method, but taking more time for 10.8 million records.
Model:
public class Data
{
public int ID { get; set; }
public List<Attribute> Attributes { get; set; }
}
public class Attribute
{
public string ATTR { get; set; }
public string ATTR_VALUE { get; set; }
}
Output:
List<Data>
=> ID = 1
=> Attributes
[0] => ATTR = A
=> ATTR_VALUE = CAR
[1] => ATTR = B
=> ATTR_VALUE = BUS
[2] => ATTR = C
=> ATTR_VALUE = TRUCK
=> ID = 2
=> Attributes
[0] => ATTR = A
=> ATTR_VALUE = CAR
[1] => ATTR = B
=> ATTR_VALUE = BUS
[2] => ATTR = C
=> ATTR_VALUE = TRUCK
can any one help me on this with LINQ and performance?
1