Skip to content

Implement BusinessDocumentBase combining BusinessBase and BusinessListBase#4815

Open
rockfordlhotka wants to merge 2 commits intomainfrom
rocky/1830-bb-blb
Open

Implement BusinessDocumentBase combining BusinessBase and BusinessListBase#4815
rockfordlhotka wants to merge 2 commits intomainfrom
rocky/1830-bb-blb

Conversation

@rockfordlhotka
Copy link
Member

@rockfordlhotka rockfordlhotka commented Feb 5, 2026

Summary

  • Implements BusinessDocumentBase<T,C>, a new base class that inherits from BusinessBase<T> and adds full BusinessListBase<T,C> collection capabilities
  • Enables the "document pattern" where a single business object has its own managed properties, validation rules, and authorization AND contains a collection of child items
  • Adds IBusinessDocumentBase<C> consolidated interface

Key Features

  • Full IList<C> collection support via composition (MobileList<C>)
  • Deleted child tracking (IContainsDeletedList)
  • N-level undo cascading to collection children
  • IsDirty/IsValid/IsBusy aggregation across properties and children
  • MobileFormatter serialization of collection items
  • CollectionChanged/PropertyChanged events
  • LoadListMode for bulk loading without events
  • Child data access (Child_Update/Child_UpdateAsync)
  • RegisterProperty / RegisterMethod with correct type resolution

Test plan

  • 29 unit tests covering:
    • Create and fetch operations
    • Collection operations (Add, Insert, Remove, RemoveAt, Clear, Contains, IndexOf, Enumerator, Indexer)
    • Status aggregation (IsDirty, IsValid, IsNew across properties and children)
    • CollectionChanged events
    • Clone / serialization preservation
    • N-level undo (BeginEdit/CancelEdit/ApplyEdit for properties and children)

Closes #1830

🤖 Generated with Claude Code

Document the design for a new class that combines BusinessBase and
BusinessListBase capabilities using composition. This enables the
"Document Pattern" where a business object has its own properties
AND contains a collection of child items.

The plan includes:
- Complete interface analysis from both base classes
- Conflict resolution strategies for shared interfaces
- 10-phase implementation plan with specific tasks
- Risk assessment and success criteria

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@hurcane
Copy link

hurcane commented Feb 5, 2026

I looked for a related discussion or issue for this PR, but didn't find one. What is the intended utility for this kind of class?

Looking at this initial plan, I wonder how more complex documents would be handled. By more complex, I mean having multiple child lists. In the invoice example, the editable Invoice class in my project would also have a comments collection, a contacts collection. Thinking across the full project, I don't have any documents with only a single collection.

@StefanOssendorf
Copy link
Contributor

You are describing a business (base) object. I think the purpose of this PR is to get the whole rules stuff etc. into a business list class.
For example you have a PositionList which has rules to enforce (e.g. only one item with Type X is allowed) and so on. This kind of rule is currently not possible because the list itself can't define rules.

@hurcane
Copy link

hurcane commented Feb 5, 2026

I get that use case. Those business rules currently have to be handled in the parent class. We typically use properties on the child classes to indicate their error state. For example, the child will have an IsDuplicate property with a rule that ensures the property is false.

I'm all for simplifying this scenario, but it wasn't clear in the description and the generated plan. Sorry for butting in without understanding the full context.

@rockfordlhotka
Copy link
Member Author

I get that use case. Those business rules currently have to be handled in the parent class. We typically use properties on the child classes to indicate their error state. For example, the child will have an IsDuplicate property with a rule that ensures the property is false.

I'm all for simplifying this scenario, but it wasn't clear in the description and the generated plan. Sorry for butting in without understanding the full context.

#1830

…BusinessListBase

Adds BusinessDocumentBase<T,C>, a new base class that inherits from BusinessBase<T>
and adds full BusinessListBase<T,C> collection capabilities. This enables the
"document pattern" where a single business object has its own managed properties,
validation rules, and authorization AND contains a collection of child items.

Key features:
- Full IList<C> collection support via composition (MobileList<C>)
- Deleted child tracking (IContainsDeletedList)
- N-level undo cascading to collection children
- IsDirty/IsValid/IsBusy aggregation across properties and children
- MobileFormatter serialization of collection items
- CollectionChanged/PropertyChanged events
- LoadListMode for bulk loading without events
- Child data access (Child_Update/Child_UpdateAsync)

Includes IBusinessDocumentBase<C> interface and 29 unit tests covering
create/fetch, collection operations, status aggregation, events, clone,
and n-level undo.

Implements #1830

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rockfordlhotka rockfordlhotka changed the title Add BusinessDocumentBase implementation plan Implement BusinessDocumentBase combining BusinessBase and BusinessListBase Feb 6, 2026
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.

Add rules engine to BusinessListBase

3 participants