This post has been migrated from www.experimentsincode.com, we apologise if some of the images or content is missing

Just a quick tip when generating code with Team Development for Sitecore. We are all used to using designer files with ASCX and ASPX files, these files contain code generated by Visual Studio which the developer should not alter:
We can setup the same thing with TDS, first lets create a file that will be the file that a developer can edit. In  this file the developer can add any customisations to the generated partial classes. I am calling my file Models.cs:
Next we need to setup the TDS project:
Notice that for the target file I have added the designer keyword, this is important because Visual Studio will automatically nest files with the designer keyword beneath a matching parent. Now if I generate my code I can see that the designer file has been added beneath my Model.cs file:
I now have the TDS generated partials in the designer and any extensions if write to the partials in the main file, this keeps everything nice and organised.  
comments powered by Disqus