Well - Getting my head in a muddle about this - maybe there is a better way to do this.
I have a heirarchy of data with zero to many relationships as follows.
Category > CategoryProduct > Product > Sku > SkuBasePrice
I have put one in a view - so it looks like this..
Category > vwCategoryProductDetails > vwSkuDetails
The problem is that I need to have a left join between Sku and SkuBasePrice based on a variable.
My questions are - ( code is below )
1) What is the best way to do this relation filter - should I be rethinking the strategy for this?
2) Once I have got all the data together , I want to cache it. How can I cache just the data ( read only ) and not the object ( as recommended in best practises ) .
Thanks
Marty
//Code
MyCategoryEntity category = new MyCategoryEntity();
//category filter
string categoryName = ""Digestive";
RelationPredicateBucket categoryFilter = new RelationPredicateBucket((CategoryFields.CategoryName == categoryName));
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
PrefetchPath2 prefetch = new PrefetchPath2((int)EntityType.CategoryEntity);
//Filter SkuBasePrice to only current Role
String[] inRole = new String[] { "*", primaryRole };
PredicateExpression skuFilter = new PredicateExpression(new FieldCompareRangePredicate(VwSkudetailsFields.RoleName, null, inRole));
prefetch.Add(MyCategoryEntity.PrefetchPathVwCategoryProductDetails).SubPath.Add( MyVwCategoryProductDetailsEntity.PrefetchPathVwSkudetails,0);
category = (MyCategoryEntity)adapter.FetchNewEntity(new MyCategoryEntityFactory(), categoryFilter , prefetch);
}