Skip to content

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
szjanikowski pushed a commit to NoesisVision/grandnode2 that referenced this pull request May 8, 2025
Refactor to use IWorkContextAccessor instead of IWorkContext
- Removed `IWorkContextSetter` methods for setting individual properties; added `InitializeWorkContext` method.
- Updated `BackgroundServiceTask` and `WorkContextMiddleware` to use `IWorkContextAccessor` and `InitializeWorkContext`.
- Added `IWorkContextAccessor` interface and `WorkContextAccessor` implementation using `AsyncLocal`.
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.

2 participants