private static LockboxPin GetObject(long id) { lock (TypeLocker) { LockboxPin obj; if (Manager.Settings.CacheData) { if (_objStore.TryGetValue(id, out obj)) { return(obj); } } using (var session = SessionFactory.OpenSession()) { obj = session.Get <LockboxPin>(id); } if (obj != null) { obj.IsNew = false; if (Manager.Settings.CacheData) { _objStore.Add(id, obj); } return(obj); } obj = new LockboxPin() { Id = id }; if (Manager.Settings.CacheData) { _objStore.Add(id, obj); } return(obj); } }
private static LockboxPin GetObject(long id) { lock (TypeLocker) { LockboxPin obj; if (Manager.Settings.CacheData) { if (_objStore.TryGetValue(id, out obj)) { return obj; } } using (var session = SessionFactory.OpenSession()) { obj = session.Get<LockboxPin>(id); } if (obj != null) { obj.IsNew = false; if (Manager.Settings.CacheData) _objStore.Add(id, obj); return obj; } obj = new LockboxPin() { Id = id }; if (Manager.Settings.CacheData) _objStore.Add(id, obj); return obj; } }