Earned MCSA SQL Server 2012/2014!

msft_partner2016Codit is a Microsoft Gold Partner in Application Development, Application Integration and Cloud Platform and a Silver Partner for Data Analytics.

This means we are required to have staff certified, which in turn requires us to take (and pass) Microsoft exams once in a while. This is not mandatory on a personal level, but still it is necessary for some people in order to retain or even improve our Microsoft Partnership.

Although it may be a lot of work to prepare for the exam, most of us are quite keen on getting certified actually. As one of the more ‘senior’ guys at Codit, I try to get certified or pass an exam at least once a year. Although it means that you will need to do some research, buy and read … and re-read the book(s), spend additional time looking up facts on MSDN, etc… I do agree it’s a nice recognition to have passed an exam.

mcsa_sql

In the last years I have been able to pass 70-461: Querying Microsoft SQL Server 2012/2014 and 70-462 Administering Microsoft SQL Server 2012/2014 Databases. Both exam preparations were actually great ways to get some recognition on working with SQL Server since 2001 (the year I graduated).
Along the way I have learned and picked up a lot from (ex-)colleagues, numerous blogs and various sources and books. Still, I was shocked at how much I was still able to learn by grabbing and reading the preparation books, doing the exercises, watching SQL courses on Pluralsight and looking up more information. It was an invaluable experience, learning so much. Some of it already came in very handy during the last year.

Since a couple of years Microsoft features the MCSA. The Microsoft Certified Solutions Associate. One of the tracks is MCSA: SQL Server 2012/2014.
It requires you to pass 3 exams: the ones mentioned above (70-461 and 70-462) and one other. Although it mentions 70-463: Implementing a Data Warehouse with Microsoft SQL Server 2012/2014 as the third exam, you can actually substitute it with any of the following as well:

Since I don’t feel that much for BI in SQL Server, I thought it was a good idea to certify for C# and took the Programming in C# exam last week.

mcsa-sql

With great pride I can now tell you that I also passed this last exam and earned the MCSA: SQL Server 2012/2014 title!

It even comes with a badge! :^)

I can only recommend it to be honest: I learned a great deal and find it very valuable in my day-to-day work.

If you have any questions, let me know and I’ll be happy to share my experience with you.

Now that SQL Server 2016 is out, Microsoft is already working on an upgrade path. Not one, but two! I know what is on the menu for 2017-2018! ;^)

Let Git ignore modifications to a file

Introduction

Lately, at Codit.eu Belgium, we have been working on an internal project after hours and during a hack day. The project and the technology allow some of us, myself included, to get out of our shell and gives us a chance to work with technology we are unfamiliar with.

It is a really interesting work environment and this has sparked my interest in some of the things I haven’t had a chance yet to become familiar with. One of those things was Git. I have experience using TFS (Team Foundation Server) on-premise and VSTS (Visual Studio Team Services), in the cloud.

While setting up VSTS, one is give the option to choose for TFVC (Team Foundation Version Control) or Git. Until now, the safe choice had always been TFVC. This project finally let me work with Git and I must say I learned a lot from this!

2-comparison

This post is not an overview on what the differences between the two are (you can find that here), but rather a difficulty I had during development.

Don’t check-in credentials in web.config

The setup and baseline of the projects were in .NET and were done by a colleague of mine familiar with it already. One of the things I encountered was the fact that we worked with Azure DocumentDb and we need to store the DocumentDb URI and key in the web.config file. However, we can’t have them in the file itself as this is in no way secure.

However, when committing or pushing changes in my local branch to the remote server, I always needed to restore the web.config in its original state. Afterwards, to test the local version again, I needed to include them again. A real problem, as this is quite cumbersome and easily forgotten.

Let Git ignore any local changes

I searched the web for a solution and after some testing I found the solution to my problem here, on StackOverflow.

git update-index --skip-worktree <file-name>

Enter the command in a git command prompt. To get one, go to Team Explorer, Changes, Actions and click Open Command Prompt.

git_cmd

The command will update your local git index and mark the file to skip during commits and to assume no changes were made, although you may actually have made them!

Perfect for our web.config which (almost) never changes!
Even more so, since this only marks your local index and the change is never propagated to the remote index! This means that every developer wanting to do so, will have to do it manually his-/herself.
This is not something that a new developer would need to know about immediately, which is a good thing!

However, whenever we need to make an actual change (one that needs to be merged in the master branch), we need to remove the credentials, make our changes and commit and push the changes remotely to create a PR (pull request).

To do so, use this command in another Git command prompt:

git update-index --no-skip-worktree <file>

Hope you enjoyed this, as this made my life a lot easier on this project!

Create a ZIP-file for your source code

When, at some point, for some reason, you would like to create a RAR- or ZIP-file for the source code you created, you can do so in WinRAR, by using the following exclude filter.

winrar_sourcecode_zip

Be aware, that this will include any *.btp.cs, *.xsd.cs, etc…
These files should not be part of your TFS/VSTS, but are created by Visual Studio.

You could add them to the filter, creating the following exclusion:

*\bin *\obj *.xsd.cs *.btp.cs

 

 

Adding behaviorExtensions to machine.config via C#

I’ve been playing around with BizTalk Deployment Framework lately and for one particular BizTalk application, I need to add 4 custom behaviorExtensions. I’ve had some very specific logic that I needed to put into some WCF Message Inspectors.

When you think about automating the installation of a BizTalk application, you don’t want to be manually adding the behaviorExtensions to the machine.config. So I set out to add these via a C# application. Seems this was not as trivial as I though it would be.

First things first, we need to be able to retrieve the location of the machine.config file:

 // Get the machine.config file.
 Configuration machineConfig = ConfigurationManager.OpenMachineConfiguration();
 // Get the machine.config file path.
 ConfigurationFileMap configFile = new ConfigurationFileMap(machineConfig.FilePath);

The above code, will give you the path of the machine.config file, depending on what runtime (x86 or x64) you are running the code under.

When running as x86, you will get the following path:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config"

When running as x64, you will get the following path:

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config"

Once the path has been found, we need to open the file and position ourselves at the correct location in the file (system.serviceModel/extensions):

// Map the application configuration file to the machine 
 // configuration file.
 Configuration config = ConfigurationManager.OpenMappedMachineConfiguration(configFile);

ConfigurationSectionGroup svcModel = config.SectionGroups.Get("system.serviceModel");
 ExtensionsSection extensions = (ExtensionsSection) svcModel.Sections.Get("extensions");

Now this is the point where I initially got stuck. I had no idea I had to cast the Section as a System.ServiceModel.Configuration.ExtensionsSection. Doing so, allows you to add your behaviorExtension in the config file as such:

ExtensionElement e = new ExtensionElement("MyName", "MyType, MyNamespace.MyType, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4275f802b89cdd22");
 extensions.BehaviorExtensions.Add(e);
 extensions.SectionInformation.ForceSave = true;

config.Save(ConfigurationSaveMode.Full);

Don’t forget to set the ForceSave, as – without it – it doesn’t seem to write the update.

All together, this gives you the following code:

// Get the machine.config file.
 Configuration machineConfig = ConfigurationManager.OpenMachineConfiguration();
 // Get the machine.config file path.
 ConfigurationFileMap configFile = new ConfigurationFileMap(machineConfig.FilePath);

// Map the application configuration file to the machine 
 // configuration file.
 Configuration config = ConfigurationManager.OpenMappedMachineConfiguration(configFile);

ConfigurationSectionGroup svcModel = config.SectionGroups.Get("system.serviceModel");
 ExtensionsSection extensions = (ExtensionsSection) svcModel.Sections.Get("extensions");

ExtensionElement e = new ExtensionElement("MyName", "MyType, MyNamespace.MyType, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4275f802b89cdd22");
 extensions.BehaviorExtensions.Add(e);
 extensions.SectionInformation.ForceSave = true;

config.Save(ConfigurationSaveMode.Full);

If you do like me and you want to adapt the x86 AND the x64 machine.config file, just replace the “Framework” in the x86 machine.config path into “Framework64” before doing the same.

I made myself a simple console application which allows me to call it while running the MSI for my BizTalk application. Only make sure the MSI runs as an administrator!

 

This post has been cross-posted at http://www.codit.eu/blog/2016/05/31/adding-behaviorextensions-to-machineconfig-via-c/