I might be one of the few NHibernate users using Code Rush (and not resharper,) but here goes:
Using NHibernate, I need all the properties and methods on my model classes to be virtual. It's tedious to go and add virtual to them all the time, and CodeRush is perfectly capable of doing this for us.
The CodeRush "p" family of templates look like this:
Notice the #PropertyDefaultScope template. This is where is says "public" or "private", and also happens to be where "static" gets inserted if we're in a static class. This seems like a good place to insert my "virtual".
There's #StaticIfNeeded, the one that decides to add "static." Let's see how that works. Maybe we can make a "#VirtualIfPossible#" template that is at least a little smart about this - i.e., doesn't add virtual if we're doing a static method, etc.
Notice that it has to be in a static class to work. Let's do that same thing, but when we're _not_ in a static class:
Now we can add that to the #PropertyDefaultScope template:
Now when I declare properties, they will be virtual by default, making it easier to build NHibernate model classes, as well as use Rhino Mocks and other things that thrive on virtualness:
