Examining the Generated cs File for a cshtml View

Cshtml files are compiled by Razor into C# files. To track down some errors (or just to understand Razor) it might be useful to examine the C# code generated. For testing I created a small Razor view in an MVC4 project. @{ string someString = "somestring"; var someBool = false; //- }   <h1>Header</h1>  … Continue reading Examining the Generated cs File for a cshtml View

All .NET Identities now Derive From ClaimsIdentity

With .NET 4.5 a new base class for identities was introduced: the ClaimsIdentity class. The reason is that Windows Identity Foundation has been fully incorporated into the .NET framework and it has really improved the .NET identity model. What is a Claim? This might be a stupid question – but I’ve had a hard time… Continue reading All .NET Identities now Derive From ClaimsIdentity

Automatic Marking of Required Fields with EditorEntryFor

Using an EditorEntryFor helper makes the code DRYer and opens new possibilities, such as automatic indication of required fields. A small addition in one helper method will mark all required fields in entire MVC web application. It’s more or less standard to indicate required fields in a form with a red * next to the… Continue reading Automatic Marking of Required Fields with EditorEntryFor

Code or Configuration or Configuration in Code?

With DevOps bringing source control to configuration files and publishing to production servers being automated – bringing both code and configuration over on the same time, the difference between code and config has become less than ever (if it even exists). A few weeks ago I reread Mike Hadlow’s brilliant post The Configuration Complexity Clock.… Continue reading Code or Configuration or Configuration in Code?