Cached lists

Cached lists

Old forum URL: forums.lhotka.net/forums/t/3526.aspx


eDjinn posted on Thursday, September 13, 2007

Using the Codesmith templates (based CSLA2.x CS 1.1.0 RC), I like the choice I have generating a single, SplitPartial of SplitBase class.
What we use a lot in our code, is static lists (that is: lists that don't change a lot, like storage places in a a warehouse.
Maybe I can suggest a change here in the templates:

ReadOnlyRootList and ObjectFactoryMethods:

private static _cachedList = null;
public static (bool useCache 0) { %>, )
(...)
if (_cachedList == null || !useCache)
_cachedList = DataPortal.Fetch>(new FilterCriteria());
return _cachedList;



EditableRootList:

protected override void DataPortal_Update()
(...)
_cachedList = null;
RaiseListChangedEvents = true;


Using these changes, most lists will be cachable by choise.

Any comments?

Copyright (c) Marimer LLC