Skip to content

#4622 Implement virtual Deserialized method#4744

Merged
rockfordlhotka merged 2 commits into
mainfrom
dev/4622-ISerializationNotification
Oct 20, 2025
Merged

#4622 Implement virtual Deserialized method#4744
rockfordlhotka merged 2 commits into
mainfrom
dev/4622-ISerializationNotification

Conversation

@rockfordlhotka

Copy link
Copy Markdown
Member

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.

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.
@rockfordlhotka rockfordlhotka linked an issue Oct 17, 2025 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 OnDeserializedHandler methods and their associated OnDeserialized attributes
  • 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.

Comment thread Source/Csla/ReadOnlyBase.cs
@rockfordlhotka

Copy link
Copy Markdown
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.

@swegele swegele left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@rockfordlhotka rockfordlhotka merged commit 366aecb into main Oct 20, 2025
2 checks passed
@rockfordlhotka rockfordlhotka deleted the dev/4622-ISerializationNotification branch October 20, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tweak/Cleanup of ISerializationNotification.Deserialized()

3 participants