Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nathan Skidmore 63 posts 251 karma points c-trib
    Jun 27, 2016 @ 10:04
    Nathan Skidmore
    1

    Get Pre Values for Data Type

    Hi,

    I was using the following code in Umbraco 7.2.0 to get all the Pre Values for a Data Type. Since upgrading to Umbraco 7.4.3, I can no longer initialize the DataTypeService with no parameters. Now it requires:

    DataTypeService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
    

    What are these values? Before I could initialize it like this:

    using Umbraco.Core;
    using Umbraco.Core.Models;
    using Umbraco.Core.Services;
    
    ...
    
    DataTypeService dts = new DataTypeService();
    
    var preValues = dts.GetPreValuesCollectionByDataTypeId(myId));
    

    The DataTypeService documentation doesn't appear to be updated to explain this change. https://our.umbraco.org/documentation/Reference/Management/Services/DataTypeService

    Any help would be appreciated.

    Many thanks,

    Nathan

  • Nathan Skidmore 63 posts 251 karma points c-trib
    Jun 27, 2016 @ 11:15
    Nathan Skidmore
    102

    I managed to fix this issue by following the advice in this thread:

    https://our.umbraco.org/forum/developers/api-questions/71765-testing-73-contentservice-c-new-contentservice

    My data type service initializer now looks like this:

    var dts = ApplicationContext.Current.Services.DataTypeService;
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies