Mad, Beautiful Ideas
.NET Strangeness: Generics and Casting

Ran into an interesting problem with .NET and it's Generics earlier today that really, really surprised me. The problem that I was trying to solve was fairly straightforward. I'm working on porting a large collection of Classic ASP Web Applications to a collection of ASP.NET MVC Web Applications, in the process upgrading the applications to more advanced web technology (and I'm not just talking about .NET).

One particular function that we deal with regularly is needing to authorize users for subsets of data, however, often the permissions of a user may differ between various applications. As such, I wanted to create a simple data type to help me display these authorizations. Now, I'm simply going to call the app App1. It has a database table called App1Authorizations which manages the special authorizations for this app.