In the DynamoDB service, a table needs to be created. The table is called ‘ASP.NET_SessionState’ and has a primary key called “SessinID” of type string.
In Visual Studio, the NuGet packages to be managed and the ‘AWS.SDK: Core’, as well as the ‘AWS.SDK for .Net: SessionProvider’ packages need to be installed.
In Visual Studio’s web.config window, the ‘<sessionState mode = “Proc…’ section needs to changed to show the following:
The keys for Access keys for this section need to be created in AWS, as the created DynamoDB doesn’t automatically have a key attached to it.
In the ShoppingCart.cs window in Visual Studio, the word ‘serializable’ needs to be inserted above the line ‘public class ShoppingCart’ and ‘public class ShoppingCartItem’ as follows:
Then in the AWS DynamoDB table, there should be no items present. However, if the DinoStore application is run, and an item is added to the ‘cart’, then the DynamoDB table will update to record the item being sold.
The only challenge that I faced with this lab was that I made the incorrect assumption that ‘Sydney’ was a usable alias for the ap-southeast-2 region in ‘Region’ under ‘<Providers>’ in the web.config window in Visual Studio. This would cause the code to break and show the following message:
Once the ‘Region’ was corrected, the code worked as expected.