Click or drag to resize

MacroAttribute Class

Allows specifying a macro for a parameter of a source template.
Inheritance Hierarchy
System.Object
  System.Attribute
    Resto.Front.Api.Attributes.JetBrains.MacroAttribute

Namespace:  Resto.Front.Api.Attributes.JetBrains
Assembly:  Resto.Front.Api.V7 (in Resto.Front.Api.V7.dll)
Syntax
C#
public sealed class MacroAttribute : Attribute

The MacroAttribute type exposes the following members.

Constructors
  NameDescription
Public methodMacroAttribute
Initializes a new instance of the MacroAttribute class
Top
Properties
  NameDescription
Public propertyEditable
Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
Public propertyExpression
Allows specifying a macro that will be executed for a source template parameter when the template is expanded.
Public propertyTarget
Identifies the target parameter of a source template if the MacroAttribute is applied on a template method.
Public propertyTypeId
When implemented in a derived class, gets a unique identifier for this Attribute.
(Inherited from Attribute.)
Top
Methods
  NameDescription
Public methodEquals
Returns a value that indicates whether this instance is equal to a specified object.
(Inherited from Attribute.)
Public methodGetHashCode
Returns the hash code for this instance.
(Inherited from Attribute.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsDefaultAttribute
When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Inherited from Attribute.)
Public methodMatch
When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Inherited from Attribute.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks
You can apply the attribute on the whole method or on any of its additional parameters. The macro expression is defined in the Expression property. When applied on a method, the target template parameter is defined in the Target property. To apply the macro silently for the parameter, set the Editable property value = -1.
Examples
Applying the attribute on a source template method:
[SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")]
public static void forEach<T>(this IEnumerable<T> collection) {
  foreach (var item in collection) {
    //$ $END$
  }
}
Applying the attribute on a template method parameter:
[SourceTemplate]
public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) {
  /*$ var $x$Id = "$newguid$" + x.ToString();
  x.DoSomething($x$Id); */
}
See Also