-
Notifications
You must be signed in to change notification settings - Fork 0
Resharper File Template
For Resharper users a File Template that can be accessed from the quick menu (Alt + Insert) can make life a bit easier. Creating migration classes for hand every time can be repetitive and a template that sets the migration attribute automatically reduces the risk of errors.
A starter File Template (Migration.DotSettings) for FluentMigrator migrations can be found in the docs folder. It can be tricky to find the download url for a single file from Github, so if you have downloaded the html for the github page by accident, the direct download url is https://github.com/schambers/fluentmigrator/raw/master/doc/VisualStudioTemplates/Migration.DotSettings (which is the same url as the Raw button in Github).
In the template are a couple of macros that set the namespace to the current assembly's namespace, class name to the filename and the migration attribute to the current date in yyyyMMddHHmm format.
The second Resharper DotSettings file (StandardAndAutoReversingMigrations.DotSettings) contains two File Templates, one for normal migration and one for Auto Reversing Migrations.
-
In Visual Studio click on the Resharper menu and open Templates Explorer and then open the File Templates tab.
-
Click the Import button and choose the Migration.DotSettings file.
-
You should now see the imported Migration template under "Not in quicklist" section.
-
Drag and drop the Migration template up to the "In quicklist" section to make it available in the quicklist.
-
Done! Now you should be able to see Migration as an option in the Alt+Insert menu for Visual Studio's Solution Explorer.
Try it out and adjust the template to suit your own style.
- Getting FluentMigrator
- How to create a Migration
- Fluent Interface
- Migration Runners
- Use inbuilt database functions when setting the default value
- Sql Server Specific Extensions
- Raw Sql Helper for inserting data
- Auto Reversing Migrations
- Resharper File Template
- Transaction Modes for the Migration Runner
- ApplicationContext: Passing parameters to Migrations
- Dealing with Multiple Database Types
- Filter migrations run based on Tags
- Enforce migration version numbering rules
- Create custom metadata for the VersionInfo table