What to do with my collection objects...
Posted on 2005-04-14
I have imported several collection objects from my class library into my asp.net app (C#). Let's say I have an EmployeeCol, DepartmentCol collection objects and I use those same objects as my dataSource for my DropDownList boxes.
Whenever I choose as Department via the dropdownListBox, the Employee dropdownlistbox will show all the employees for the currently selected department.
Anyways, whenever the page is posting back, my EmployeeCol and DepartmentCol are set to null and I will have to re-instantiate them on the page_load event and fill my objects with the appropriate objects.
What I am wondering about whether it's common practice to assign a collection object into the session variable? I suppose it would be a performance hit having to cast it back into the appropriate type but would be offset by not having to creating objects and not talking to the database but not sure on that.
Hope this post made somewhat sense...if not please feel free to ask questions, comments, suggestions...etc.