Does anyone want FileType to always be uppercase?

Oct 3, 2014 at 2:50 PM
I wanted to filter on FileType in a query against the FileTable the other day, and found that LightSwitch doesn't (easily) deal with case-insensitive queries. To be fair, the problem isn't LightSwitch, but the collation of the database (which is usually case sensitive) and Entity Framework, but, either way - you can't just issue a switch in your SQL syntax to get back a case-insensitive result.

I could set this up to where the FileType is always returned in upper case by changing one line of code (e.g., return the FileType.ToUpperInvariant()). You'd still be able to get the original (as cased for the file itself) file type by extracting it from the file name. This way, if filtering by file type (and there are surely lots of reasons to do that), you don't have to deal with case permutations - the extension will return only the file type(s) you wanted without extra filtering.

Alternate solution would be to add a property called InvariantFileType that gives you to the FileType.ToUpperInvariant() instead of whatever the original case was.

Thoughts / opinions?