JSON IList Covariance
An Unexpected Roadblock I ran into a an unexpected roadblock the other day when refactoring code that controls JSON de-serialization. It forced me to read up on the dreaded topic of covariance and contravariance in C#. During code review, I was asked to change the technique I used to specify how JSON should be de-serialized into a root type that includes properties typed as interfaces. The conundrum is what classes should be instantiated for these properties? I solved this problem using Json.NET JsonSerializerSettings.TypeNameHandling. This embeds type names into JSON text as properties named “$type”. When the JSON text is de-serialized, […]
Encrypting a File
Previous Efforts Back in February, I decided it was time to demystify the black box of secure Internet communications. I have been a professional programmer too long to continue carrying a hazy understanding of how web browsers and servers communicate securely. I wanted to remove HTTPS / SSL / TLS from the realm of magic and place it in the realm of the known and understood– a computer algorithm implemented in C# code. So I researched the topic, learned the underlying mathematics, wrote code to prove the theory actually works in practice, then wrote three blog posts explaining what I […]
My ASP.NET Core MVC + SOA Architecture
Architecture Diagram Having adopted .NET Core while it was in beta and using it to implement numerous projects over the last three years, I’ve settled on an MVC + SOA architecture. I say settled because I don’t know if I can claim to have developed it. I don’t how original it is. Anyhow, this is the architecture I use in my projects. Below the diagram I define terms and describe the principles of my architecture. Click diagram to download PowerPoint source. Terminology MVC Model View Controller SOA Service Oriented Architecture AJAX Asynchronous Javascript and XML. More accurate would be AJAJ […]