Add Polymorphic Child List documentation#26
Open
rockfordlhotka wants to merge 1 commit into
Open
Conversation
Documents how to create a BusinessListBase that safely holds polymorphic (heterogeneous) editable child types, covering the three CSLA constraints: - a CRTP abstract base (Base<T> where T : Base<T>) so each leaf gets its own property-registration identity - a shared item-type interface extending IBusinessBase so MobileFormatter can serialize the collection - hand-coded managed properties, since [CslaImplementProperties] does not generate for types deriving from a user-defined base Placed in the common (version-neutral) area and linked from README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Adds a new documentation page,
csla-examples/PolymorphicChildList.md, describing how to build aBusinessListBaseroot list that safely holds polymorphic (heterogeneous) editable child types — e.g. aSurveyResultListcontaining bothAssetSurveyResultandContactSurveyResult, which share aSurveyResultbase.The document is placed in the common (version-neutral) area and linked from the README's Topic-Specific Documents table.
What it covers
The pattern works, but only if three CSLA-specific constraints are met. Each is documented along with the exact runtime/compile error produced if violated:
SurveyResult<T> where T : SurveyResult<T>. A non-generic shared base throwsCannot register property X after containing type has been instantiatedonce a second subclass adds managed properties.IBusinessBase— typing the list against an interface that extends onlyIEditableBusinessObjectcompiles but throwsCannot serialize collections not of type IMobileObjectin MobileFormatter.[CslaImplementProperties]emits an empty partial for any type whose direct base is a user-defined class, so managed properties must useRegisterProperty/GetProperty/SetProperty.Validation
Every claim was verified against a working CSLA 10.1.0 sample project (fetch of a mixed list,
Clone()/MobileFormatter round-trip preserving concrete types, and save viaChild_Update()).