PersistenceTestResult TryCompare() { IDataConnection conn = null; try { conn = spec.SessionProvider.GetConnection(); conn.EvictFromCache(spec.Entity); var retrieved = conn.GetQuery().Get <T>(identity); if (ReferenceEquals(retrieved, null)) { return new PersistenceTestResult(typeof(T)) { SavedObjectNotFound = true } } ; var equalityResult = spec.EqualityRule.GetEqualityResult(spec.Entity, retrieved); EnsureEqualityResultMayBeReportedUpon(equalityResult); return(new PersistenceTestResult(typeof(T)) { EqualityResult = equalityResult }); } catch (Exception ex) { return(new PersistenceTestResult(typeof(T)) { ComparisonException = ex }); } finally { conn?.Dispose(); } }