Correct way to check for existance of data

Apr 12, 2011 at 3:55 AM
Edited Apr 12, 2011 at 4:14 AM

Just curious what is the quickest most appropriate/safest way to check if no data has ever been loaded?  I have a single object I want to cache which I set the key True as per the QuickStart

I came up with the following:

var localCache = (EpmManager.LocalCacheDatabase.Query<EpmCacheLookupData, bool>().Where(c => c.Key)).First();
if (localCache.LazyValue.IsValueCreated) LoadCacheFromServer(); else return localCache.LazyValue.Value;