-
Notifications
You must be signed in to change notification settings - Fork 931
Fix ISession.Refresh not updating initialized lazy properties #3697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
342122e
to
ffc8a79
Compare
private readonly string entityName; | ||
private readonly System.Type mappedClass; | ||
|
||
private readonly string[] originalUninitializedFields; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be same as uninitializedFieldsReadOnly
It is possible to update content of read-only set by updating underlying collection. It is expected that some tests will fail because they depend on that behavior.
this.entityName = entityName; | ||
this.mappedClass = mappedClass; | ||
this.uninitializedFieldsReadOnly = uninitializedFields != null ? new ReadOnlySet<string>(uninitializedFields) : null; | ||
this.uninitializedFieldsReadOnly = uninitializedFields != null ? new ReadOnlySet<string>(new HashSet<string>(uninitializedFields)) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a bug that ReadOnlySet is not really read-only
It was possible to update content of read-only set by updating underlying collection.
Some tests were depend on that behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely an improvement, but I'd like to know more before I change it. So I added an extra variable.
public ISet<string> GetUninitializedFields() | ||
{ | ||
return uninitializedFieldsReadOnly ?? CollectionHelper.EmptySet<string>(); | ||
return uninitializedFields ?? CollectionHelper.EmptySet<string>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to return uninitializedFields
, because some tests were depending on the of ReadOnlySet.
Fixes #3622