writing re-call headers
Elements and attributes in the re-call header
As explained in the wxegen.exe overview, a re-call header specifies page-local variables for a re-call page/re-call function. A typical declaration looks like this (printed without the leading comment //):
<WxeFunction>
<Parameter name="obj" type="Customer" />
<ReturnValue type="Invoice" />
<Variable name="fooBar" type="FooBar" />
</WxeFunction>
(The order of nodes is significant here.)
The meaning of this example re-call header roughly corresponds to a C# declaration like
Invoice MyFunc(Customer obj)
{
FooBar fooBar;
...
}
Since angle brackets (<>) must be escaped in XML, a declaration like <ReturnValue type="ObjectList<Customer>" /> is invalid and must be re-phrased as
<ReturnValue type="ObjectList<Customer>" />
or, more readably (and writably):
<ReturnValue type="ObjectList{Customer}" />.
(Note the curly brackets substituting angle brackets. The mechanism is the same as in C#'s DocComments.)
More features exist, but they are rarely used. You can find the xml-schema for WXE-headers in the SVN repository
What follows is a brief discussion of those extra elements.
Understanding WxePageFunction attributes
The attributes of WxePageFunction are optional and override defaults.
attribute | overrides | example |
|---|---|---|
| The ASP.NET-type behind the page | |
| The .aspx file with the same base name as the file the declaration is in | |
| The name of the function class that will be generated. Default is name of the page class + "Function" | |
functionBaseType | the name passed to | |
As path to the aspxFile the path specified in the file mask (first) parameter to wxegen.exe is assumed, as in
wxegen UI\*.aspx.cs WxeFunctions.cs /prjfile:PhoneBook.Web.csproj /functionbase:...
note UI*.aspx.cs parameter
uigen.exe builds the project with the assumption that the generated files (specified in wxegen.exe's file mask parameter) shall be stored in a project sub-folder named UI.
In/out parameters for the Parameter element
The optional direction attribute for Parameter can specify whether the parameter is an in or out parameter or both:
<Parameter param1 direction="In" />
<Parameter param2 direction="Out" />
<Parameter param3 direction="InOut" />
The default is In.
Mind the usings, important note for ReSharper users
wxegen.exe copies the using s from the file with the WXE function header to wxefunctions.cs, so that all types can be resolved. However, if a type is used only in a function header, then a tool like ReSharper might deem the using statement covering the type redundant and remove it. Workaround: fully qualified type names for all types.