Versions Compared

Key

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

...

The Default attribute is used to set the default value for this property. If you omit this attribute, then CodeSmith does Generator does not supply a default value for the property.

...

The Category attribute specifies what category this property should appear under in the CodeSmith Explorer property sheet. If you omit this attribute, CodeSmith will Generator will place the property in a category named Misc.

...

The Optional attribute specifies whether or not this property is optional. If a user does not specify a parameter that is not optional then CodeSmith will Generator will not let them proceed. A value of true means that a value for the property is not required, and a value of false means that a value for the property is required.

...

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;}
  }

...