Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To declare a property, you use a Property directive. For example, this directive defines a property named ClassName of type System.String:

Code Block
languagehtml/xml
<%@ Property Name="ClassName" Type="System.String" Category="Context" Description="The name of the class to be generated." %>

Property Directive Attributes

The Property directive has nine possible attributes. The Name and Type attributes are required, and the other attributes are optional.

...

The Editor attribute specifies the GUI editor that will be used in the property grid for this property. This is equivalent to placing an [EditorAttribute] on a code propertyUITypeEditors are marked as deprecated and will be removed in a future version.

Info

You should specify the editors full name when using the Editor attribute.

Code Block
languagehtml/xml
<%@ Property Name="ModelDirectory" Type="System.String" Editor="System.Windows.Forms.Design.FolderNameEditor, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %>



Info
For a full list of available editors please see the following page.
EditorBase

The EditorBase attribute specifies the base type for the editor. If none is specified, then UITypeEditor is assumed. UITypeEditors are marked as deprecated and will be removed in a future version.

Serializer

The Serializer attribute specifies the IPropertySerializer type to use when serializing the property's values. This is equivalent to using a [PropertySerializerAttribute] on a code property.

OnChanged

The OnChanged attribute specifies the event handler to fire when the property value changes.

DeepLoad

The DeepLoad attribute is only used on SchemaExplorer objects. When set to true, SchemaExplorer will grab all your schema information in advance saving make multiple round trips back to your database.

Declaring a Property From the CodeBehind

Declaring a property from code is essentially like creating a property in any class. The most notable options using Attributes to help you describe your property, it's location, and it's editor.

Example:

Code Block
xml
xml
private string aliasFilePath;

  [Editor(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
  [Category("01. General")]
  [Optional]
  [DefaultValue("")]
  [Description("Optional File Path to a table/object alias file.")]
  public string AliasFilePath
  {
   get {return this.aliasFilePath;}
   set {this.aliasFilePath = value;}
  }

...