shopId shopname ProductcategoryID categoryname ProductName
----- --------- --------- ----- ---------
1 test1 1 Value1 testpd1
1 test1 1 Value1 testpd2
1 test1 2 Value2 testpd3
1 test1 2 Value2 testpd4
2 test2 1 Value3 testpd5
2 test2 1 Value3 testpd6
2 test2 2 Value4 testpd7
2 test2 2 Value4 testpd8
My Product Storedprocedure output is above sql flat result from this i want to convert into my class objects.
class Shop
{
int shopid{get;set;}
string shopname{get;set;}
list<ProductCategory> PC{get;Set};
}
class ProductCategory
{
int Productcategoryid
string categoryname{get;set;}
list<ProductName> PN{get;set;}
}
class ProductName
{
int productID{get;set;}
string productname{get;set;}
}
how can i convert above sqlflat result into my nestedobjects as shown above. the final object should be a list of shop objects which it self contains category objects and category objects contains product object.