Contents tagged with Tips
-
CI Deployment Of Azure Web Roles Using TeamCity
After recently migrating an important new website to use Windows Azure “Web Roles” I wanted an easier way to deploy new versions to the Azure Staging environment as well as a reliable process to rollback deployments to a certain “known good” source control commit checkpoint. By configuring our JetBrains’ TeamCity CI server to utilize Windows Azure PowerShell cmdlets to create new automated deployments, I’ll show you how to take control of your Azure publish process.
-
Git Aliases
Many git users may not be aware that you can setup git aliases for either providing shortcuts to existing commands (like typing ‘git co’ instead of ‘git checkout’) or even for creating entirely new commands (‘git hist’ for printing your git history formatted how you like it). Git aliases can be local to a single repository, or (more commonly) global.
-
Deploy NuGet Packages During CI Build with TeamCity
One great benefit of having a Continuous Integration server like TeamCity (http://www.jetbrains.com/teamcity/) building your code is that you can hook into the build process to have it also handle tedious or time-consuming tasks for you, such as running all of your unit tests, code coverage analyses, etc.
-
Inflector for .NET
I was writing conventions for FluentNHibernate the other day and I ran into the need to pluralize a given string and immediately thought of the ruby on rails Inflector. It turns out there is a .NET library out there also capable of doing word inflection, originally written (I believe) by Andrew Peters, though the link I had no longer works. The entire Inflector class is only a little over 200 lines long and can be easily included into any project, and contains the Pluralize() method along with a few other helpful methods (like Singularize(), Camelize(), Capitalize(), etc).
-
Introducing Data Annotations Extensions
Validation of user input is integral to building a modern web application, and ASP.NET MVC offers us a way to enforce business rules on both the client and server using Model Validation. The recent release of ASP.NET MVC 3 has improved these offerings on the client side by introducing an unobtrusive validation library built on top of jquery.validation. Out of the box MVC comes with support for Data Annotations (that is, System.ComponentModel.DataAnnotations) and can be extended to support other frameworks. Data Annotations Validation is becoming more popular and is being baked in to many other Microsoft offerings, including Entity Framework, though with MVC it only contains four validators: Range, Required, StringLength and Regular Expression. The Data Annotations Extensions project attempts to augment these validators with additional attributes while maintaining the clean integration Data Annotations provides.
-
Simple SQL Server Script For Generating NHibernate Classes/Mappings
With the growing popularity of Fluent NHibernate, mapping files are being used less and less. However if you are using HBM/XML mapping files I recently dug up an old SQL script (originally written by my colleague Alan Lai, since modified slightly by myself) which might help. The SQL Script basically generates some mapping/public property fields from an existing database that you can manually copy around into you application to save you some keystrokes.
-
Authorizing Access via Attributes in ASP.NET MVC Without Magic Strings
Recently I developed a strategy which I think works well for authorizing access to user groups (Roles) without using the string names of those groups.
-
Making ASP.NET MVC Actions be Transactional By Default
Given any action method (we’ll use Index), if there is no attribute it should execute in a Transaction:
-
Inserting Transactions into Telerik’s ASP.NET MVC Grid
[The List View]
-
Major Hack: Repository Tests With NHibernate And SQLite on a CI Server
I recently setup my first continuous integration build server using JetBrains’ TeamCity product, and it couldn’t have been much simpler. However I kept running into an issue with my test projects whenever I was using NHibernate or SQLite (very useful or regression tests against an in-memory database).