This project is read-only.

Understanding the T4 files

The package adds a number of T4 files to your project. This pages explains what those files do, how to use them and how to extend them.


  • generates a partial class which implements ICommerceEntity for each entity defined in Commerce Server metadata in a single CommerceEntitites.cs. The generated file will have a namespace appropiate for your project. If you modify Commerce Server metadata, add or remove entities you should regenerate CommerceEntities.cs by resaving
  • is the template used by for each entity. If you want to add code to be added to each generated entity you should modify this template.


  • generates a simple factory for returning Controllers defined in CommerceServerContrib.Web. If you change or add controllers either modify the .tt or the .cs. Remember that if you re-save it will overwrite ControllerFactory.cs so you'll probably want to modify the .tt or modify the .cs and change the properties on the .tt to prevent it from running.
  • generates an exception used to return Request Template Service Adapter errors. You'll see this exception used in the Request Template static methods.
  • generates RequestTemplates.cs which contains a static class for each subsystem in Commerce Server (Orders, Catalog, etc.). Each of those classes contain static methods which correspond to Request Templates. So, the Request Template GetProductSummary becomes MyNamespace.RequestTemplates.Catalog.GetProductSummary(string productId, string catalodId). It will also generate a MyNamespace.RequestTemplates.Catalog.GetProductSummaryQueued(string productId, string catalodId) which returns an instance of the CommerceServerContrib controller so many calls to the Foundation can be queued and issued at once.
  • is the template used by to generate the static methods for each template. If you want to modify what is generated for each template change this file.


  • contains a few helper methods that are used by the other templates.

Last edited Nov 14, 2012 at 2:41 PM by bthubbard, version 3


No comments yet.