Editorials

Use an Alias To Enable Collaboration

Recently I have been working on a project using a local instance of Microsoft SQL Server. The project is collaborative. Each developer has their own instance. The database connection string(s) for Entity Framework, and other Apps, have been named based on an instance name of SQL Server. The problem is that each developer installed SQL Server at different times, with different names. So, the value of the database connection string is constantly in flux, depending on who checked in last.

We could use different build configurations for each developer, and use xslt to name the database connection string, as required by the local database name. This requires a bit of work, and is necessary for each different SQL Server instance name.

I rolled back to the old SQL Server solution of creating an Alias. SQL Server ships with the SQL Server Configuration Manager, where you can create an alias for connecting to SQL Server. I created an alias for the default instance SQL Server name to be used in the configuration files. I found I had to create both a 32 bit and 64 bit alias depending on the version of the code being published.

If the individual workstation did not have an SQL Server instance with the standardized name, an alias was created, allowing all of us to work collaboratively without competing for the latest value in app.config. Everyone is happy, and we didn’t have to uninstall/reinstall SQL Server in order to change the instance name.

For more details on how to do this, I found a good blog from Marius Schulz.

Cheers,

Ben