If you follow my blog, you know that one of the most prominently featured topics if Entity Framework. A not very-well known, but very useful feature of Entity Framework Code First is the ability to add your custom sql generators that are used when you create sql scripts from your migrations and to add your custom code generators that are used when C# code is created from your migrations. I have used these features in my previous posts: here's the one for auditing (fun fact: this is one of my greatest hits), the one for soft delete, and the one for adding an index for TPH discriminators.
I have used custom generators in some of my projects as well, but since this is not a very well known and widely used feature, finding the corresponding documentation takes some time :) So I thought I would create a Visual Studio extension that has an item template for a custom sql generator and a custom C# code generator.
After downloading the extension from the marketplace, you have the option to add a "Custom migration code generator" or a "Custom migration sql generator" to the project:
The generator items add nice little classes with the required boilerplate and some comments to help you get started:
I understand that this probably will never be one of the most downloaded extensions, but hopefully some of you might find it useful ;) Check out the source code on Github, if you feel like it. Ideas and PRs are always welcome.