RingSoft.DbLookup.Controls.WPF.Properties Namespace
RingSoft.DbMaintenance Namespace

MacroAttribute Class

Allows specifying a macro for a parameter of a source template.

Namespace:  RingSoft.DbLookup.Controls.WPF.Properties
Assembly:  RingSoft.DbLookup.Controls.WPF (in RingSoft.DbLookup.Controls.WPF.dll)

Syntax


[AttributeUsageAttribute]
public sealed class MacroAttribute : Attribute
<AttributeUsageAttribute> _
Public NotInheritable Class MacroAttribute _
	Inherits Attribute
[AttributeUsageAttribute]
public ref class MacroAttribute sealed : public Attribute

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:
C#
[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:
C#
[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); */
}

Inheritance Hierarchy


Object
  Attribute
    RingSoft.DbLookup.Controls.WPF.Properties..::..MacroAttribute