iikoFront Api V8 Code Reference
iikoFront Api V8 Code Reference
Resto.Front.Api.Attributes.JetBrains
MacroAttribute Class
MacroAttribute Constructor
MacroAttribute Properties
MacroAttribute Methods

# 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.V8 (in Resto.Front.Api.V8.dll) Version: 1ca4876affdd3bc5359a98b321fc115a647d2251
Syntax
C#
Copy

    public sealed class MacroAttribute : Attribute

The MacroAttribute type exposes the following members.

Constructors

| Name | Description
--- | --- | ---
| MacroAttribute | Initializes a new instance of the MacroAttribute class

Top
Properties

| Name | Description
--- | --- | ---
| Editable | Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
| Expression | Allows specifying a macro that will be executed for a source template parameter when the template is expanded.
| Target | Identifies the target parameter of a source template if the MacroAttribute is applied on a template method.
| TypeId | When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.)

Top
Methods

| Name | Description
--- | --- | ---
| Equals | Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)
| GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.)
| GetType | Gets the Type of the current instance. (Inherited from Object.)
| IsDefaultAttribute | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
| Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
| ToString | 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:
Copy

    [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:
Copy

    [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

#### Reference

Resto.Front.Api.Attributes.JetBrains Namespace