简体   繁体   中英

Get all property types - Umbraco 7

I'm trying to follow an example, but I think it was written for an older version so I am looking for the umbraco 7 equivalent to this:

List<PropertyType> types = PropertyType.GetAll().ToList();

Umbraco.Core.Models.PropertyType' does not contain a definition for 'GetAll' - this is the current error I am getting.

You can use new services. For working with DataTypes - DataTypeService

            var ds = ApplicationContext.Current.Services.DataTypeService;
            var dataTypes = ds.GetAllDataTypes();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM