Created
May 17, 2019 14:00
-
-
Save mattbrailsford/6446b15b39cd33544d71b92ce9a27f21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All service have access to an ISessionManager that persists | |
// the current ids for the session (ISessionManager interface | |
// defined in core, with implementation in web project to | |
// store values in session / cookies OOTB) | |
OrderService.Get/SetCurrentOrder(); | |
CurrencyService.Get/SetCurrentCurrency(); | |
CountryService.Get/SetCurrentPaymentCountry(); | |
CountryService.Get/SetCurrentPaymentRegion(); | |
CountryService.Get/SetCurrentShippingCountry(); | |
CountryService.Get/SetCurrentShippingRegion(); | |
PaymentMethodService.Get/SetCurrentPaymentMethod(); | |
ShippingMethodService.Get/SetCurrentShippingMethod(); | |
// Example | |
var order = OrderService.GetCurrentOrder(storeId); | |
order.Items.AddOrUpdate(...); | |
OrderService.SaveOrder(order); | |
// Concerns | |
"Current" setting/getting is split across multiple services so | |
requires accessing multiple end points. More confusing? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Services are ISessionManager un-aware and instead | |
// the SessionManager stores and accesses session | |
// related entities. SessionManager then become the | |
// interface to get/set all session related entities | |
SessionManager.Get/SetCurrentOrder(); | |
SessionManager.Get/SetCurrentCurrency(); | |
SessionManager.Get/SetCurrentPaymentCountry(); | |
SessionManager.Get/SetCurrentPaymentRegion(); | |
SessionManager.Get/SetCurrentShippingCountry(); | |
SessionManager.Get/SetCurrentShippingRegion(); | |
SessionManager.Get/SetCurrentPaymentMethod(); | |
SessionManager.Get/SetCurrentShippingMethod(); | |
// Example | |
var order = SessionManager.GetCurrentOrder(storeId); // Get via session manager | |
order.Items.AddOrUpdate(...); | |
OrderService.SaveOrder(order); // Save via order service | |
// Concerns | |
Disparate that you get from SessionManager but you'd still | |
need to go via the OrderService etc to save any changes back |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment