I have a big (4M records) table on a SQL Server with the following columns:
keep in mind that Id is not unique for this table. Basically, I'd like to write a LINQ query that retrieves Ids and all its associated PropertyName/PropertyValue pairs:
is this feasible in some way?
Thank you in advance
Not sure regarding performance but you can use GroupBy to group your data by similar Ids
Something like:
var result =
from x in whatever
group x by x.Id into g
select new {
Id = g.Key,
Data = g.ToDictionary(i => i.PropertyName, i => i.PropertyValue)
};
Refer to 101 LINQ Samples to learn more about Linq
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With