...
Because
...
you
...
can
...
define
...
a
...
property
...
as
...
being
...
...
,
...
you
...
may
...
want
...
to
...
validate
...
the
...
property
...
in
...
your
...
template
...
to
...
determine
...
whether
...
or
...
not
...
the
...
user
...
has
...
entered
...
a
...
value.
...
For
...
example,
...
you
...
might
...
want
...
to
...
allow
...
generating
...
a
...
class
...
either
...
with
...
a
...
namespace
...
declaration
...
or
...
without,
...
at
...
the
...
user's
...
option.
...
To
...
do
...
this,
...
you
...
would
...
first
...
define
...
an
...
appropriate
...
optional
...
property:
...
Code Block | ||
---|---|---|
| ||
<%@ Property Name="ClassNamespace" Type="System.String" Optional="True" Category="Context" Description="The namespace that the generated class will be a member of." %>{color}
|
In
...
your
...
template,
...
you
...
can
...
check
...
to
...
see
...
whether
...
there's
...
a
...
value
...
in
...
this
...
property
...
at
...
runtime.
...
If
...
so,
...
you
...
want
...
to
...
output
...
the
...
appropriate
...
namespace
...
declaration.
...
If
...
you're
...
using
...
C#
...
as
...
your
...
template
...
language,
...
you'd
...
do
...
that
...
like
...
this:
...
Code Block | ||
---|---|---|
| ||
<% if (ClassNamespace \!= null && ClassNamespace.Length > 0){color} { %> namespace%>namespace <%= ClassNamespace %> { <% } {color:navy}%>{color} If your template is using VB, the equivalent code is: {color:navy}%> |
If your template is using VB, the equivalent code is:
Code Block | ||
---|---|---|
| ||
<% If Not ClassNamespace Is Nothing AndAlso ClassNamespace.Length > 0 Then %>{color} {color:navy}Namespace <%= ClassNamespace %>{color} {color:navy}<% End If %>{color} |