Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 802 Bytes

data-persistence.md

File metadata and controls

33 lines (22 loc) · 802 Bytes

Data Persistence (CRUD)

The Umbraco Services layer is used to query and manipulate Umbraco stored in the database.

Dependency injection

All services are available using their interfaces in the dependency injection container. ASP.NET Core supports dependency injection in almost every scenario.

Constructors in classes

    public class MyClass
    {
        private readonly IContentService _contentService;

        public MyClass(IContentService contentService)
        {
            _contentService = contentService;
        }
    }

Constructors in views

    @inject IContentService ContentService

Services

There is a service for each type of data in Umbraco.

See here For a full list of services available