[MonoDevelop] [Patch] Mark T4-generated classes with 'partial'

Michael Hutchinson m.j.hutchinson at gmail.com
Mon Nov 30 18:42:33 EST 2009


On Fri, Nov 27, 2009 at 3:32 PM, Olivier Dagenais
<olivier.dagenais at gmail.com> wrote:
> Hi,
>
> I'm using Mono.TextTemplating to generate templates that will be
> compiled into my program.  In order to keep the template code clean, I
> have found it useful to define the "other half" of the code in a
> partial class of the same name as the generated one, similar to the
> way ASP.NET .as?x files can use methods defined in the associated
> .as?x.cs file.  In my testing with .NET, the compiler does not care if
> a type is marked 'partial' but only ever has one definition, so there
> should be no harm (that I see!) in generating all template classes
> that way.
>
> This code is licensed to Novell/Mono under the MIT License.  The patch
> was created with
> <http://anonsvn.mono-project.com/source/trunk/monodevelop/main/src/addins/TextTemplating>
> as a base.  Let me know if you need me to change anything, etc.

Yup, I see no harm in it either. It should be especially useful when
we allow generating template classes from tt files within MD, like
VS2010 does (http://monodevelop.com/Developers/Tasks/Tools/T4#_task_a_T4.ClassGenerator).

Committed, thanks!

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list