Abstract classes as action parameters in .NET Web API 4.0

(I had this sit­ting in draft form for years now, and I just dug it up. Most of it is pret­ty obso­lete, with .net core and all, but I’ll just leave this here.)

In a pre­vi­ous post, I dis­cussed a method for using abstract class­es in ASP.NET MVC 4.0. With it, I was able to clean up and hide the details of imple­men­ta­tion from much of my code. I assumed that it would be rel­a­tive­ly sim­ple to do the equiv­a­lent in Web API, but  I found that the task to be quite different.

The equiv­a­lent func­tion­al­i­ty requires use of asyn­chro­nous pro­gram­ming, code gen­er­a­tion, and some com­plex pro­cess­ing for han­dling things like IEnumerable. I also found some race con­di­tions that need­ed to be addressed.

Continue read­ing “Abstract class­es as action para­me­ters in .NET Web API 4.0″