public void Reload() { Util.Check(Session != null, "Cannot reload record {0} - it is not attached to a session. ", EntityInfo); // Executing SelectByPrimaryKey automatically refreshes the values in the record // In some situations we need to elevate read, // Ex: record permissions are granted thru reference on other entity; user has no any permissions for entity type, // so SecureSession.ExecuteSelect would permissions for entity type and throw AccessDenied using (Session.ElevateRead()) { // var cmdInfo = EntityInfo.PrimaryKey.SelectByKeyValueCommand; // var cmd = new LinqCommand(cmdInfo, this.EntityInfo, PrimaryKey.Values); Session.SelectByPrimaryKey(this.EntityInfo, PrimaryKey.Values); } this.ClearTransientValues(); }
}//method public void Reload(bool disableCache = false) { Util.Check(Session != null, "Cannot reload record {0} - it is not attached to a session. ", EntityInfo); // Executing SelectByPrimaryKey automatically refreshes the values in the record // In some situations we need to elevate read, // Ex: record permissions are granted thru reference on other entity; user has no any permissions for entity type, // so SecureSession.ExecuteSelect would permissions for entity type and throw AccessDenied //if (cacheEnabled) Session.EnableCache(false); using (Session.ElevateRead()) { if (disableCache) { using (Session.WithNoCache()) Session.ExecuteSelect(EntityInfo.CrudCommands.SelectByPrimaryKey, PrimaryKey.Values); } else { Session.ExecuteSelect(EntityInfo.CrudCommands.SelectByPrimaryKey, PrimaryKey.Values); } } }