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