Skip to content

ProjectTracker: lift TimeStamp into intermediate base classes#4859

Open
rockfordlhotka wants to merge 1 commit intomainfrom
sample/intermediate-base-with-timestamp
Open

ProjectTracker: lift TimeStamp into intermediate base classes#4859
rockfordlhotka wants to merge 1 commit intomainfrom
sample/intermediate-base-with-timestamp

Conversation

@rockfordlhotka
Copy link
Copy Markdown
Member

Summary

  • Demonstrates the pattern of an intermediate subclass between Csla.BusinessBase<T> / Csla.BusinessDocumentBase<T,C> and concrete BOs, where the intermediate declares its own registered properties that are inherited by every concrete BO.
  • Lifts the TimeStamp (byte[]) concurrency token — present in all five candidate BOs — into ProjectTracker.Library.CslaBaseTypes.BusinessBase<T> and BusinessDocumentBase<T,C>. These two intermediate types existed previously but were empty shells.
  • Fixes a latent bug: ResourceAssignmentEdit, ProjectResourceEdit, and RoleEdit wrote : BusinessBase<X> which (under using Csla;) silently bound to Csla.BusinessBase<T>, not the local intermediate. The intermediate was unused even where it looked otherwise. Now qualified to CslaBaseTypes.BusinessBase<X>.

Why this is useful as a sample

The CSLA documentation discusses application-wide intermediate base classes, but no sample demonstrated declaring registered properties on the intermediate. This change makes ProjectTracker a working reference for that pattern.

Notes

  • The intermediate uses GetProperty(TimeStampProperty)! (null-forgiving) — the same pattern used inside the CSLA framework (e.g. DataPortalErrorInfo.cs). The CSLA0007 analyzer false-positives on this so a #pragma warning disable is applied with a comment explaining why.
  • MobileFormatter handles inherited registered properties automatically — no extra serialization work needed.
  • The Csla auto-implement source generator's base-class detection is a substring match on BusinessBase/BusinessDocumentBase, so the local-namespace intermediates work transparently.

Test plan

  • dotnet build Samples/ProjectTracker/ProjectTracker.sln — clean (0 errors; only pre-existing NU1603 NuGet version warnings)
  • Smoke-run the Blazor host: create/fetch/save Project and Resource to confirm the byte[] concurrency token round-trips through MobileFormatter when the BO crosses the data portal

🤖 Generated with Claude Code

Demonstrate the pattern of an intermediate subclass between
Csla.BusinessBase<T> / Csla.BusinessDocumentBase<T,C> and concrete
business objects, where the intermediate declares its own registered
property (TimeStamp byte[] concurrency token) used across multiple BOs.

Also fixes ResourceAssignmentEdit, ProjectResourceEdit, and RoleEdit
which silently inherited from Csla.BusinessBase<T> via `using Csla;`
instead of the local CslaBaseTypes.BusinessBase<T> they appeared to
target.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant