hiya,
ok, i have looked at both examples.At the moment, I simply want it to want work in the same way as the sql I supplied earlier:
@categoryID int
AS
DECLARE @parentID int
DECLARE @category varchar(50)
DECLARE @categoryGUID nvarchar(50)
DECLARE @output varchar(500)
DECLARE @loopCount int
SET @parentID=9999
CREATE TABLE #cats(
categoryID int,
category varchar(50),
categoryGUID nvarchar(50),
listOrder int
)
SET @loopCount=1
while(@parentID <>0 AND @loopCount<10)
BEGIN
SELECT @parentID=parentID,
@category=categoryName,
@categoryGUID=categoryGUID
FROM CSK_Store_Category WHERE categoryID=@categoryID
IF(@category<>'')
SET @output=@output+';'+@category
INSERT INTO #cats(categoryID, category, categoryGUID, listOrder) VALUES(@categoryID, @category, @categoryGUID, @loopCount)
SET @categoryID=@parentID
SET @loopCount=@loopCount+1
END
SELECT * FROM #cats ORDER BY listOrder DESC
DROP Table #cats
RETURN
Now, all I need to display is typedList (preferably) or collection that contains 2 fields from Csk_Store_Category table:
categoryGUID
categoryName
So, question #1, can I use a typedList / does it have to be an entityCollection to store the end results?
(obvioulsy I need to use other fields to create the recursive list, but I only need the 2 fields as an output)
Taking Matt's as the starting example, I can obtain the categoryGuid filter:
IPredicateExpression filtProductCategory = new PredicateExpression();
Guid g = new Guid(categoryGUID);
filtProductCategory.Add(dalHamilton.HelperClasses.CskStoreCategoryFields.CategoryGuid == g);
I will only ever supply a SINGLE categoryGUID..So, question #2 I think that this will work for me?
Question #3
As far as the collection / typedList that will hold the data, I assume I can use a concrete collection type, becasue I know what it will be:
dalHamilton.CollectionClasses.CskStoreCategoryCollection = new CskStoreCategoryCollection();
This is as far as I have managed.If anyone could confirm any of the above it'd be a great help.As I said before, I want to get it working as simply as possible.Then, I iprove performance later if necessary.
many thanks,
yogi