Hi,
I am having tables with the following structure
Territory(Table)
--- NetworkId(Columns)
--- LocationId(Columns)(FK)
Location(Table)
--- Id(Columns)(PK)
--- SubBrickId(Columns)(FK)
SubBrick(Table)
--- Id(Columns)(PK)
--- BrickId(Columns)(FK)
Brick(Table)
-- Id (Columns)(PK)
-- RegionId (Column)(FK)
Region (Table)
--- Id(Column)(PK)
--- CountryId(Column)(FK)
Country
--- Id(PK)
All the above tables have descriptionId column and this column is associated with a respective resource tables in our project.
I need to retrieve the brick,subbrick, region and country details for a given networkid.
What i had done is getting a territoryEntity collection. Already done the prefetch and applied the networkid filter. So while executing all the related entities are fetched in a single call..no lazyloading. Here the subbrick,brick,region and country queries return the expected rows.
For retrieving the list of subbrick details i had looped through for each territoryentity in the
territoryentity collection object.
done code like this
foreach(TerritoryEntity row in territories)
{
SubBrickEntity subBrick = row.Location.SubBrick_;
//Populating the list control for binding
fillSubbrick.Add(subBrick.Description,subBrick.Id)
//Description property is a custom property we had defined in the subbrick partial class
}
I am getting duplicate values for subbrick for each and every networkid. Please let me know how can i retrieve the distinct subbrick values or there is any other method to retireve the subbrick collection seperately.
Help is very much appreciated.
Thanks
Prabhu