Comic Book Shop — Full Stack .NET — Version 1.0.3
I have this ‘comic book shop’ .NET full stack projec that I use in my coding classes. This is about the version 1.0.3 update.
Here is the full list of changes.
- The usual documentation updates with improved guidelines and steps on how to run the project
- Updated Connection String for all projects to be more specific along with change in spelling, specifically to use username and password, even for localDB authentication.
- Fixed the issue where, Product API and Order API Sharing DB. Before the fix, there were 5 DBs, although, there are a total of 6 micro services. I don’t know why I made it this way, and this is against the whole idea of micro services. could be something that i missed during development.
- Also, there were some issues with the Azure Service Bus not processing the queue related messages. Switched both the IEmailService and IAzureServiceBusConsumer from ‘Singleton’ to ‘Scoped’ and made related changes to the project to work with Scoped Dependency instead of Singleton Dependency.
- After the Singleton to Scoped changes, can confirm that, all the queues are being processed and logged by the Email API Service to the db.
- Also, IMessageBus and it’s implementation were dependent on a hard coded connection string for azure service bus. This has been replaced by IMessageBus2 which reads the connection string obtained via the appsettings.json, which is how it should be.
- But, I have left the IMessage Bus file as it is for educational purposes.
- Updated the docs for the same.
You can see the entire pull request, here, on GitHub.
7 update connection string by Jay-study-nildana · Pull Request #12 · Jay-study-nildana/comicbookshop
Now, here are some things I noticed as I was making these updates.
First up, for some reason, despite the emphasis on making every project in the solution a ‘micro service’, I had, for some reason decided to use the same database for the ‘ProductAPI’ and the ‘ShoppingCarAPI’. For the life of me, I cannot understand why I did it this way.
Anyway, now, this is fixed now.
Another issue was the usage of a ‘hard coded’ connection string in the ‘MessageBus’ class library. Once again, this at odds with my general approach to programming. Even more odd because, I am making extensive use of appsettings.json file for everything else, except for this one component.
This one, is less of a mystery. When I built the project, I did not know if it is possible to use an appsettings.json file with a class library. So, for the sake of convenience, I decided to hard code the connection string. Today, I tried to use a appsettings.json file in the class library. However, despite my best efforts and the persistent help from GitHub CoPilot Pro, I was unable to figure out a straightforward solution.
So, I came up with an alternative solution. I decided to use the existing appsettings infrastructure in each service and read the connection string and pass it as a parameter to the Message Bus. At this point, I don’t know if this is the most elegant approach. However, it achieves the goal of removing the hard coded connection string. So, I can live with this.
You can find the project documentation, here.
Comic Book Shop — Documentation — Version 1.0.3 | comicbookshop
You can find the project GitHub Board, here.
There are always bugs and fixes awaiting attention. I welcome you to contribute and become involved.
I work as a coding tutor. You can hire me on Upwork, Fiverr and Codementor. You can also book a session on calendly, and visit my website. Also, video tutorials on my YouTube Channel.