Relative path to config file in BIDS/SSIS 2008 package configurations

As we know using absolute paths in our code can complicate things from a deployment point of view, so it’s best to use relative paths were possible. In business intelligence studio 2008 however the package configuration wizard doesn’t allow you to enter relative paths when pointing to configuration files. If you attempt to type a relative path in, clicking next will replace it with the absolute path, so we appear to have a problem here.


There is an easy work around however, rather than using the GUI just edit the .dtsx file directly to point to the relative path. For example if in BIDS package configuration window you have entered the path as ‘c:\SSIS\active.dtsconfig’, simply change that to ‘..\SSIS\active.dtsconfig’ using a text editor and next time you open the wizard the relative path will be used.

What do senior developers do differently to other software developers?

Matt Briggs has recently wrote one of the best overviews of what it means to be a senior developer that I have read. In the post he contrasts the role of the senior developer with that of junior and intermediate developers noting what all three usually focus on.

Matt’s post helped crystallise my views on this but for me the difference between senior and other developers is like the difference between how and why. Decent developers of any career level are able to find out how technically to do things whereas seniors developers are more focused on the why… or perhaps why not… to use a certain technology or methodology. Remember just because something can be used or done, doesn’t mean it should, everything involves a trade off and there is no universal ‘right way’ just an estimated ‘most appropriate’ way given the current project particulars.

In agreement with Matt, I found senior developers to be much more pragmatic than their less senior counterparts who tend to want to produce more pure and ‘beautiful’ code. Senior developers are always looking for the most simplest not the most complex or most pure way of implementing solutions. Senior developers know the concept of ‘good enough’. They are able to reign themselves in when others might be trying to make their code look like art. They know that even though the big books might recommend the repository pattern (for example) in case an ORM needs to be ‘switched out’ in the future, implementing such an abstraction could result in an over engineered system. All other things being equal, the senior developer will choose the simplest solution that meets the requirements regardless of dogma.

Always considering the why rather than just the how and being pragmatic rather than purist are the main differences for me between seniors and others, but check out Matt’s excellent post for more. There is good discussion going on over there in the comments section including some readers asking about how they can become senior developers. Well before I finish I’d like to offer my views on that. Four or five years ago I was the intermediate developer Matt talks about in his post, I’d read a book about this or that that some Microsoft MVP had wrote and almost religiously think that was the way software should be written. The end result was that I needlessly made much software I wrote more complex than it needed to be. What has helped me progress is working for the last five years or so in consulting whereby I might be working on one project for 10 months, another for six months, then yet another for nine and so on. Given that all these projects are for different companies the sheer range of experiences, problems/solutions, domains, developers not to mention over engineered complex software you come into contact with and learn from is staggering. I don’t think you can become a senior developer without getting lots of varied experience under your belt. In that regard I’d recommend consultancy work if you can get it.

Discouraging use of the var keyword and ternary if operator

I would always favour typing more code to make it more explicit, more readable and to ensure consistency in style throughout a software system. Minimising the bytes and lines needed to do something shouldn’t take preference over readability. My two pet hates in this regard are the var keyword and ternary (?) if operator.

I know var is just syntactical sugar and everything is still type safe, but for me it just moves C# in the direction of a non type safe language at least in regard to syntax style and personally I just don’t like using it. I spoke to another developer about it recently and he was very dogmatic that it is a good thing as its shorter and more concise. I agree in some instances that that can certainly be the case but because it’s not appropriate for all declarations such as:

var myVariable = System.IO.File.Open("test.txt", FileMode.Create);


var id = GetId();

it means a developer will either a) use var everywhere including in statements like the above where the type is in fact not obvious or b) use explicit declarations for statements like above and use var declarations for statements such as:

var names = new List<string>();

which means you either have many instances of variable declarations which are hard to understand or inconsistent coding style. If var is used at all another developer will no doubt come along and use it inappropriately so I prefer to discourage its use.

As far as ternary operator (?) ifs are concerned, again I prefer not to use them. I’d rather just use a standard multi-line if through the whole system, this way everything is explicit and the judgement call of whether the use of ? actually makes a particular if statement easier to understand or not is eliminated. I mean for simple expressions they can be neat but the problem is that in a team environment the precedent set by using them at all results in their overuse by less skilled developers. For example it definitely wouldn’t surprise me to see statements like the below:

int a = b > 10 ? c < 20 ? 50 : 80 : e == 2 ? 4 : 8;

pop up in a code base which has instances of ? already for simple expressions. Again then for reasons related to removing ambiguity about the appropriateness or not of its use, I discourage writing if statements with the ternary operator.

Code is read much more than its written so don’t save a couple of seconds using c# shorthand when writing it if it’s possible this will slow down those maintaining it.

Improving performance of read only selects in entity framework by turning off tracking with AsNoTracking method

We had a new contractor start the other day in work and he brought to my attention the ability to tell entity framework to not track (e.g. bypass the ObjectStateManager) the results of a query using the AsNoTracking method which if you are only loading entities once may result in a performance boost.

The order of the performance boost appears to be less significant in EF 6 than it is in EF 5 in terms of both time to complete and memory usage. The specific performance increase achieved will of course depend on how complex your model is and how many rows your looking to pull back from the database. In this example EF 5 showed a time to complete difference of 9% and EF 6 showed a difference of 3% between queries executed with and without tracking enabled.

I’m not sure how I missed this one before but this method appears very useful when querying read only data which you might just be using to populate a drop down or similar HTML element for example. Examples of how AsNoTracking can be implemented are on the MSDN article ‘Performance Considerations for Entity Framework 4, 5, and 6

As that article points out however be mindful that bypassing the ObjectStateManager disables the cache and thus if you retrieve the same entities multiple times from the same context, using AsNoTracking could actually worsen the performance of your queries. 

Get all foreign keys and their cascade actions in SQL Server

Cascading deletes and updates are not for everyone and often they can cause problems or are better alternatives to using them. If you do use them and want to confirm what the update and delete actions are, the following query will do the trick to find all foreign keys in SQL Server along with their cascade actions: 

SELECT name, update_referential_action_desc, delete_referential_action_desc
FROM sys.foreign_keys