Skip to content

ApplicationData: Refactor to dual-type pattern for packaged/unpackaged#6378

Merged
Scottj1s merged 4 commits into
mainfrom
refactor/applicationdata-dual-type
May 27, 2026
Merged

ApplicationData: Refactor to dual-type pattern for packaged/unpackaged#6378
Scottj1s merged 4 commits into
mainfrom
refactor/applicationdata-dual-type

Conversation

@Scottj1s
Copy link
Copy Markdown
Member

@Scottj1s Scottj1s commented Apr 4, 2026

Replace runtime branching (if m_unpackagedApplicationData) with separate WinRT implementation types. Both ApplicationData and UnpackagedApplicationData now derive directly from ApplicationDataT, and the factory constructs the appropriate type. Same pattern applied to ApplicationDataContainer.

This eliminates 17+ repeated if-checks, removes the shared_ptr indirection for containers, and makes each type self-contained with no branching.

A microsoft employee must use /azp run to validate using the pipelines below.

WARNING:
Comments made by azure-pipelines bot maybe inaccurate.
Please see pipeline link to verify that the build is being ran.

For status checks on the main branch, please use TransportPackage-Foundation-PR
(https://microsoft.visualstudio.com/ProjectReunion/_build?definitionId=81063&_a=summary)
and run the build against your PR branch with the default parameters.

Replace runtime branching (if m_unpackagedApplicationData) with separate
WinRT implementation types. Both ApplicationData and UnpackagedApplicationData
now derive directly from ApplicationDataT, and the factory constructs the
appropriate type. Same pattern applied to ApplicationDataContainer.

This eliminates 17+ repeated if-checks, removes the shared_ptr indirection
for containers, and makes each type self-contained with no branching.
Comment thread dev/ApplicationData/UnpackagedApplicationData.cpp Outdated
Comment thread dev/ApplicationData/UnpackagedApplicationData.cpp Outdated
@Scottj1s
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Scottj1s Scottj1s merged commit 60daee2 into main May 27, 2026
42 of 50 checks passed
@Scottj1s Scottj1s deleted the refactor/applicationdata-dual-type branch May 27, 2026 19:55
Scottj1s added a commit that referenced this pull request May 27, 2026
#6378)

* ApplicationData: Refactor to dual-type pattern for packaged/unpackaged

Replace runtime branching (if m_unpackagedApplicationData) with separate
WinRT implementation types. Both ApplicationData and UnpackagedApplicationData
now derive directly from ApplicationDataT, and the factory constructs the
appropriate type. Same pattern applied to ApplicationDataContainer.

This eliminates 17+ repeated if-checks, removes the shared_ptr indirection
for containers, and makes each type self-contained with no branching.

* Add [[maybe_unused]] to parameters in UnpackagedApplicationData

Updated function signatures to use [[maybe_unused]] for unused parameters.

---------

Co-authored-by: agniuks <41223743+agniuks@users.noreply.github.com>
Scottj1s added a commit that referenced this pull request May 28, 2026
…ata.GetForUnpackaged() (#6371)

* ApplicationData: Unpackaged support (#6277)

* ApplicationData.GetForUnpackaged() and supporting implementation

* Integrated UnpackagedApplicationData into ApplicationData

* Added tests. Removed debugging and dead code

* 61684930: [2.0 servicing] WindowsAppSDK: Microsoft.Windows.Storage.ApplicationData.GetForUnpackaged()

* Fixed RuntimeCompatibility symbol reference

* ApplicationData: Refactor to dual-type pattern for packaged/unpackaged (#6378)

* ApplicationData: Refactor to dual-type pattern for packaged/unpackaged

Replace runtime branching (if m_unpackagedApplicationData) with separate
WinRT implementation types. Both ApplicationData and UnpackagedApplicationData
now derive directly from ApplicationDataT, and the factory constructs the
appropriate type. Same pattern applied to ApplicationDataContainer.

This eliminates 17+ repeated if-checks, removes the shared_ptr indirection
for containers, and makes each type self-contained with no branching.

* Add [[maybe_unused]] to parameters in UnpackagedApplicationData

Updated function signatures to use [[maybe_unused]] for unused parameters.

---------

Co-authored-by: agniuks <41223743+agniuks@users.noreply.github.com>

* Update change ID for GetForUnpackaged method

---------

Co-authored-by: agniuks <41223743+agniuks@users.noreply.github.com>
Co-authored-by: Scott Jones <sjones@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants