.Typewrapper is the format the GenY typewrappers uses to define what types and members to genereate code for. The actual typewrapper files are just xml that look like this:

      <Namespace Name="ConsoleApplication14"/>
      <Type Name="Button">
        <IncludeMember Name="Click">

The Name-of-wrapper is the name that MEF uses to identify this perticular typewrapper. The Include and Exclude(not shown) element and Include/ExcludeMember elements define what types and members are sent to the wrapper. If any IncludeMember element is present for a perticular type, only those members will be sent to the typewrapper, if no such elements are present, all members for that type will be included, except for those defined in ExcludeMember elements.

Some time in the future i'll make a proper xsd and a vs item template, but right now, Geny must be manually applied as a custom tool to .typewrapper files.

A typewrapper file can contain any number of <Name-of-Wrapper> elements. Each of them will be invoked and get their own output file.

Creating your own typewrapper

Creating a type wrapper is quite easy. Simply implement the ITypeWrapper interface and apply the Typewrapper attribute to a class, place it in the TypeWrapper directory and your type wrapper will get picked up. The type wrapper framework will take care of filtering and only call your typewrapper with the relevant types and members. it will also find and load all the assemblies the project references. it also creates an appdomin for assembly loading and code generation and unloads it when generation is complete.

Last edited Oct 13, 2009 at 8:21 PM by aL3891, version 4


No comments yet.