Contents tagged with T4
This post is the following part of Contract Generation (1/2).
In previous post about Model description, we discussed how we could describe webservices using a common XML file that will be used by the tools we will be writing in order to manage them. It is now time to start dealing with all the repetitive tasks and makes your hand dirty. We will start with a basic template to output all contracts in one C# file directly, and we will move to a cleaner solution as tutorials will go.
As we have seen in the introduction blog post, managing web services can be a repetitive and error-prone task, as it requires many manual steps from the developer. The only parts where he adds some real value to the project are when:
- He defines what the service do (usually by defining the contract)
- He implements the service.
We have decided that we will develop some tools that help the developer and improve his productivity. These tools will be based on an interface in which the developer can manage his web services (CRUD operations). This interface will need a common “model”, an in-memory representation of his web services. This is what we will focus on this post.
If you want an introduction on what T4 is, please read previous post.
One way to detect where T4 can be interesting is by finding where the developer job starts to become repetitive (and most of the time error-prone). In most of my projects, one of this part was web services (and operations) declaration and management.
In the following (and first) serie of posts, I will try to introduce one nifty feature that deserves more recognition than it currently has: text generation using T4 templates. If you are an avid Microsoft developer, you probably have used T4 when manipulating the Entity Framework. But before talking about examples of this feature (which will be described in further articles), let’s start with the basics.