Kevin Rich
AutoMapper / ReSharper Configuration
Fixing the cause of a ridiculous slowdown
The Challenge
While working on a project, I noticed that Visual Studio ground to a halt while I was working on a rather in-depth AutoMapper profile. Something clicked in the back of my head, remembering a similar issue I experience about a year ago. Both times I had experienced this issue, the slowdown happened while editing an . . .
Posted in: automapperlinqperformanceresharper
Dealing with XML
A quick guide to the XmlSerializer
I don't work with XML Serialization much, but every now and again I find myself working on something that requires a little XML love. I recently answered a StackOverflow question regarding the subject.
What's covered
- Understanding the parts of an XML document
- Setting up a POCO class to mirror an XML document . . .
Posted in: asp.netserialiazationserializersxml
Configuring Swashbuckle for API key Authentication
A followup to adding Authentication Filters
Scenario
Recently, I wrote about adding custom authentication filters to a .NET MVC project. As a user of Swashbuckle, I needed to factor the filter into my swagger specs.To do this,we need to configure the Swagger configuration to include the api-key requirement information and configure the SwaggerUI configuration to inject some . . .
Adding User Claims via API keys in WebApi 2
Adding a Custom Authentication Filter
Update
Please for the love of all that is holy, don't do this. There are many great solutions out there now. I recommend Azure AD (cheap), Auth0(freeish), or Identity Server(open sou). This was a pretty terrible implementation that was meant as a stopgap.
Scenario
I have an API that I wish to lock down via an . . .
Posted in: asp.netauthenticationfiltersmvc5webapi
WebApi JSON Serialization
Circular References FTL
The Challenge
I was building a standard ASP.NET EntityFramework / WebApi / Swagger project. Attempting something a bit new, I decided my controller would return a CreatedAtRoute HttpActionResult. The code goes something a little like this:
[HttpPut]
public IHttpActionResult AddMyObject([FromBody] MyObject newObject)
{ . . .
Posted in: asp.netdevelopmententity-frameworkjsonjsonserializationexceptionmediatypeformatterserialiazationserializerswebapi
Reading Embedded Files
Unit Testing a Stream (Part 1)
Scenario
There are several cases in which reading text from a file is more is more convenient than writing a string in the middle of my code. I've done this occasionally for SQL statements, text templates, and unit testing sample XML or JSON. For my money, it keeps the code looking cleaner and easier to read, as well as having . . .
Star Trek: The Original Series
A Viewing Guide For the Uninitiated
I was recently hired as a Senior .NET Developer at a new company, and most of my time has been taken architecting a revamp of the system in order to increase stability and reduce coupling. I figured I'd take a break and get down to a post I've been meaning to do for awhile for a friend of mine who has never watched the original series . . .
Cover image credit: http://whoiskevinrich.com