public EntityRecord Lookup(EntityKey primaryKey, EntitySession session) { var strKey = primaryKey.AsString(); var data = _cacheTable.Lookup(strKey); if(data == null) return null; var needVersion = session.Context.EntityCacheVersion; if(data.Version < needVersion) { _cacheTable.Remove(primaryKey.AsString()); return null; } var rec = new EntityRecord(primaryKey); Array.Copy(data.Values, rec.ValuesOriginal, data.Values.Length); rec.SourceCacheType = CacheType.Sparse; session.Attach(rec); return rec; }
public EntityRecord Lookup(EntityKey primaryKey, EntitySession session) { var strKey = primaryKey.AsString(); var data = _cacheTable.Lookup(strKey); if (data == null) { return(null); } var needVersion = session.Context.EntityCacheVersion; if (data.Version < needVersion) { _cacheTable.Remove(primaryKey.AsString()); return(null); } var rec = new EntityRecord(primaryKey); Array.Copy(data.Values, rec.ValuesOriginal, data.Values.Length); rec.SourceCacheType = CacheType.Sparse; session.Attach(rec); return(rec); }