Now that VS 2017 is ready it is time to update the template extensions I provided for previous Visual Studio versions. However this time the templates themselves don’t really need to change. Instead the VS extension that I wrote to wrap them needs to be updated to take advantage of the newer VS extension features.
T4 Templates Update for Visual Studio 2015
A while back I posted a series of articles on how to use T4 and a custom VS extension to simplify some common code like application settings, WCF clients and environmental transforms. With the release of Visual Studio 2015 I had to update my own extension and templates so I wanted to posted a follow up article on the changes that need to be made to allow the extension to work with Visual Studio 2015. As part of the update I added some functionality to the app settings template. Before continuing be sure to download the previous version of the series (or simply download the final version below).
A Smarter WCF Service Client, Part 5
After a long delay I’m finally ready to finish up my series on creating a smarter WCF service client. Please refer to the previous articles for where we’re at.
- Identifying the issues with service references and the existing WCF client code
- Creating a smarter WCF service client
- Simplifying the calling of a WCF service
- Creating the skeleton client template
We’re now ready to generate the T4 template to back the client template.
A Smarter WCF Service Client, Part 4
In the last article we presented a solution for calling WCF services that needed only a single line of code and no
using statements. But it had many limitations including
- Reliance on a static class
- Testability was low for any code using it
- Reliance on the WCF client rather than the contract
- Not optimized for multiple calls
In reality the previous series of articles where all about setting up the infrastructure to support the final solution. All this infrastructure will be hidden from code when we are done. Let’s get started.
A Smarter WCF Service Client, Part 3
In the last article we replaced the standard WCF service client with an improved version. But beyond solving an issue with cleaning up the client we haven’t really improved the calling code any. In this article we are going to look at one approach for making the calling code cleaner. The less code that is needed to call something the cleaner it tends to make code. We will present one approach for making WCF calls one-liners. This is not always the best solution so we will talk about the disadvantages as well.
A Smarter WCF Service Client, Part 2
In the last article we made a case for why the standard WCF client generated by a service reference is not a great idea. Among the issues listed were testability and proper cleanup. To fix these issues we will need to ultimately replace service references altogether but this is time consuming for large code bases. When we started down this path at my company we did it using an iterative approach. While the intermediate stages may appear to be (and, in fact, may be) a step back we are ultimately working toward a solution that I believe is far better.
A Smarter WCF Service Client, Part 1
WCF is a great way to implement service-based APIs but the standard approach to consuming a service lacks a lot to be desired. In this series of articles I will discuss the approach that I’ve used in commercial applications to make consuming WCF services much cleaner and simpler. We will start with the standard approach and identify its flaws. From there we will work toward a solution that has minimal impact on consumers while providing maximal benefit. The solution itself is large but not overly complex. More importantly, once finished, you never need to worry about it again.
Environmental Transforms/AppSettings Transforms for Visual Studio 2013 Preview
In a recent series of articles I discussed how to create an environmental tranform template that could be run on each build. I also posted a series of articles on how to generate a template to generate a strongly typed class to back appsettings in a configuration file. Alas shortly thereafter VS2013 Preview was released and changes to VS have broken the code. This post will discuss the minor changes that need to be made to get everything to work.
Environmental Config Transforms, Part 2
In the previous article we updated the build process to support environmental config transforms in projects and to have the transforms run on any build. In this article we are going to package up the implementation to make it very easy to add to any project. There are a couple of things we want to wrap up.
- Place the .targets file into a shared location
- Add an import into the current project to the .targets file
- Add environmental config transforms into the project
- Remove the default config transforms generated by Visual Studio
Environmental Config Transforms, Part 1
Configuration file transforms have been around for quite a while and most companies use them to generate different config files for each environment but Visual Studio does not really support the functionality most companies need.In this article I’m going to talk about why the existing Visual Studio implementation is flawed and how to fix it so that you can have true environmental transforms that are actually useful.
For purposes of this article we will assume a simple web application (although it applies to any application) that will be deployed to 2 different environments – test and production. We will also assume that developers debug the application on their local machine and therefore should not have to do any special tasks to debug the application locally. As such we’ll have a 3th, default, environment – debug.