So I have this class as follows

public class Category
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public int Value { get; set; }
        public int ParentID { get; set; }
        public string ReferenceValue { get; set; }
        public List<Category> Children { get; set; }
    }

It maps to the table in the DB. ID are distinct IDs, Parent IDs are
the ID of the parents they belong too.

      ID    Name    ParentID    ReferenceId
eg: 1.     X           1              Null
      2.     Y          1              oneValue
      3      Z           1              twoValue
      4      A           2             ChildValue1
      5      B           2             ChildValue2

So I would like to load this structure in the class when the
global.asax runs and store in OnApplicationStart. Then I would use
that stored structure to call the data and avoid all the db calls

Now I am unable to figure out how to get the data in the structure
recurrsively, return it and then use it whenever it is required.

Anyone know a method to retrieve such data from the table and store it
in Application ?
Thanks in advance

SM

Reply via email to