#4622 Implement virtual Deserialized method#4744
Merged
Merged
Conversation
FIRST: Can the method ISerializationNotification.Deserialized be marked overridable so we can hook into it?...as a replacement for the old OnDeserialized. No need for any parameters in the new method AFAIK. SECOND: See ReadOnlyBase.cs Line 513 -> Inside the method void ISerializationNotification.Deserialized(), why does the code new up an System.Runtime.Serialization.StreamingContext() and pass it to the method private void OnDeserializedHandler(? That context parameter is unused so it is not needed. Also that extra method seems pointless, the little code there could simply be moved into original method. Same thing in BusinessRules.cs THIRD: Why is the attribute [System.Runtime.Serialization.OnDeserialized] added to the previously mentioned (seemingly useless) method private void OnDeserializedHandler only in the ReadOnlyBase and BusinessRules classes? That attribute is not used or referenced anywhere.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses deserialization extensibility concerns by introducing a virtual Deserialized() method across multiple base classes, replacing the previous pattern that used unnecessary OnDeserializedHandler methods with unused StreamingContext parameters and redundant OnDeserialized attributes.
Key Changes:
- Added protected virtual
Deserialized()methods to enable derived class customization of post-deserialization behavior - Removed obsolete
OnDeserializedHandlermethods and their associatedOnDeserializedattributes - Simplified the
ISerializationNotification.Deserialized()implementation by eliminating unnecessary intermediate method calls
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Source/Csla/Rules/BusinessRules.cs | Replaced OnDeserializedHandler with virtual Deserialized() method while preserving _syncRoot initialization |
| Source/Csla/ReadOnlyBase.cs | Introduced virtual Deserialized() hook but removed critical FieldManager and BusinessRules initialization logic |
| Source/Csla/Core/ObservableBindingList.cs | Added virtual Deserialized() method for extension point consistency |
| Source/Csla/Core/ExtendedBindingList.cs | Added virtual Deserialized() method for extension point consistency |
| Source/Csla/Core/BusinessBase.cs | Added virtual Deserialized() method call after existing deserialization logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Member
Author
|
Note: This does not include making anything async. That is a much bigger task and will be either a separate PR or will happen in a future version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FIRST:
Can the method ISerializationNotification.Deserialized be marked overridable so we can hook into it?...as a replacement for the old OnDeserialized. No need for any parameters in the new method AFAIK.
SECOND:
See ReadOnlyBase.cs Line 513 -> Inside the method void ISerializationNotification.Deserialized(), why does the code new up an System.Runtime.Serialization.StreamingContext() and pass it to the method private void OnDeserializedHandler(? That context parameter is unused so it is not needed. Also that extra method seems pointless, the little code there could simply be moved into original method. Same thing in BusinessRules.cs
THIRD:
Why is the attribute [System.Runtime.Serialization.OnDeserialized] added to the previously mentioned (seemingly useless) method private void OnDeserializedHandler only in the ReadOnlyBase and BusinessRules classes? That attribute is not used or referenced anywhere.