Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/WorkContextAccessor #549

Merged
merged 9 commits into from
Dec 29, 2024
Merged

Conversation

KrzysztofPajak
Copy link
Member

No description provided.

Refactored the handling of the work context in the application:
- Removed `IWorkContextSetter` methods for setting individual properties; added `InitializeWorkContext` method.
- Updated `SendNotification` in `PlaceOrderCommandHandler.cs` to use the new work context initialization.
- Removed `CurrentHost` from `IWorkContext`.
- Updated `BackgroundServiceTask` and `WorkContextMiddleware` to use `IWorkContextAccessor` and `InitializeWorkContext`.
- Registered `IWorkContextAccessor` as a singleton and `IWorkContextSetter` as a scoped service in `StartupApplication`.
- Removed `WorkContext` class and related methods.
- Added `IWorkContextAccessor` interface and `WorkContextAccessor` implementation using `AsyncLocal`.
- Introduced `WorkContextSetter` class to manage the work context, including current customer, store, language, and currency.
- Added utility methods for language determination, customer management, and context initialization.
@KrzysztofPajak KrzysztofPajak merged commit 68790b9 into main Dec 29, 2024
5 checks passed
@KrzysztofPajak KrzysztofPajak deleted the refactor/work-context-accessor branch December 29, 2024 17:06
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