Custom Entity Type Configurations in Entity Framework Code First (Part 1)
One of the things I really like about Entity Framework Code First is the way you can mix declarative configuration (I.e., by using Data Annotation attributes) with programmatic configuration for more complicated cases (I.e., by using the fluent API). The one aspect of this that really bothers me though is that in normal usage the fluent API commands end up being placed inside your DbContext class removed from your actual entity. If you change some aspect of an entity that uses the fluent API for configuration, you have to remember to go check the OnModelCreating() method to ensure you don't need to modify the code-based configuration. It would be much better (in my opinion) if all configuration, declarative and programmatic, were located close to the entity and/or encapsulated within it. This article explains one way of accomplishing this.
Automatically Generating Column Titles For A KendoUI MVC Grid
I love KendoUI, especially because of the available MVC wrappers. It is a very well engineered product with lots of opportunity for extension, and in this post I'll briefly discuss one that should relieve a small pain point: generating grid column titles from a DisplayAttribute data annotation. As you probably already know, you can change the way your UI layer presents properties of your model by applying the DisplayAttribute data annotation. This causes most of the UI code to use the Name property of the attribute when displaying that property. It looks like this:
Getting an HtmlHelper for an Alternate Model Type
First off, I'm back and have a lot of little tips to blog about over the next several weeks. Since my last post I have changed jobs and am no longer working with Mono, Gtk#, or XML on a daily basis. However, I am still developing for the .NET platform and have been focusing recently on ASP.NET MVC and Entity Framework. Now, on to the topic at hand...