MacroService
MacrosService will be removed in the next version.
Defines the MacroService, which is an access to operations involving IMacro.
Browse the API documentation for IMacroService interface.
Namespace:
Umbraco.Cms.Core.ServicesAssembly:
Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
using Umbraco.Cms.Core.Services;For Razor views:
@using Umbraco.Cms.Core.ServicesGetting the service
Dependency Injection
If you wish to use the macro service in a class, you need to specify the IMacroService interface in your constructor:
public class MyClass
{
    private IMacroService _macroService;
    public MyClass(IMacroService macroService)
    {
        _macroService = macroService;
    }
}In Razor views, you can access the macro service through the @inject directive:
@inject IMacroService MacroServiceLast updated