Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    Aug 21, 2015 @ 15:17
    Jason Espin
    0

    Umbraco.Core.Models.IPublishedContent does not contain a defintion for 'GetCulture' despite using the latest version of Umbraco

    Hi all,

    I have just upgraded an old Umbraco 7.1 project to now use Umbraco 7.2 so that I can get access to a page's culture programatically. The problem I have though is that the upgrade completed successfully but for some reason this method which should be present in this version of Umbraco doesn't seem to work. This is really important as I need this value to request translations from an external service.

    I know for a fact it works with a clean install of Umbraco but the fact of the matter is this is an older project and we cannot start completely from scrath with this. Any help would be greatly appreciated.

    Kind regards,

    Jason Espin

  • Jason 122 posts 637 karma points
    Aug 21, 2015 @ 16:03
    Jason
    0

    Are you doing this in a view, controller, surface controller or web api controller? External lib? Basically need a bit more info on how you are trying to do this exactly. My first though is that you are not referencing the updated DLL some how, but that is just a stab in the dark.

  • Jason Espin 368 posts 1335 karma points
    Aug 21, 2015 @ 16:08
    Jason Espin
    0

    Hi Jason,

    I am using this in an UmbracoApiController. Basically the code I am using is as follows:

            // Define shared search providers
            BaseSearchProvider AxumSearcher = Examine.ExamineManager.Instance.SearchProviderCollection["AxumSearcher"];
    
            // Search for all homepages from the XML cache and add them to a dictionary
            ISearchCriteria criteria = AxumSearcher.CreateSearchCriteria();
            IBooleanOperation query = criteria.NodeTypeAlias("homepage");
    
            ISearchResults results = AxumSearcher.Search(query.Compile());
            foreach (SearchResult page in results)
            {
                try
                {
                    IPublishedContent homepage = Umbraco.Content(page.Fields["id"]);
                    homepageCultures.Add(homepage.GetCulture().ToString(), homepage);
                }
                catch (Exception ex)
                {
                    Log.Error("Failed to find homepage from index id : " + page.Fields["id"]);
                }
            }
    
  • Jason Espin 368 posts 1335 karma points
    Aug 21, 2015 @ 16:09
    Jason Espin
    0

    I have used this code in the same way on other projects using the latest version of Umbraco so I know that it works and it needs to work on this Upgraded project as well.

  • Jason Espin 368 posts 1335 karma points
    Aug 21, 2015 @ 16:20
    Jason Espin
    0

    I'm also now getting the following error when trying to run the Umbraco solution:

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
    
    Parser Error Message: Unrecognized attribute 'disableAlternativeTemplates'. Note that attribute names are case-sensitive.
    
    Source Error:
    
    
    Line 155:  <web.routing
    Line 156:    trySkipIisCustomErrors="false"
    Line 157:    internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false"
    Line 158:    umbracoApplicationUrl="">
    Line 159:  </web.routing>
    
    
    Source File: C:\Users\Jason\Documents\Lost World Adventures Solution\Lost World Adventures\config\umbracoSettings.config    Line: 157
    

    I can't believe it's 2015 and still Umbraco seem incapable of updating correctly.

  • Jason 122 posts 637 karma points
    Aug 21, 2015 @ 16:22
    Jason
    0

    Did you only upgrade to 7.2? I may be mistaken but was this not added to 7.2.5?

  • Jason Espin 368 posts 1335 karma points
    Aug 21, 2015 @ 16:33
    Jason Espin
    0

    HI Jason,

    I upgraded to 7.2.8

    Kind regards,

    Jason Espin

  • Jason 122 posts 637 karma points
    Aug 21, 2015 @ 19:05
    Jason
    0

    Well, as you have figured out 7.2 had some breaking changes. I have to admit that I am not sure exactly what the issue you are having is but I would double check that you have merged all the config file correctly, that the project builds ok and the DLL's did get updated. Wish I could be of more help.

Please Sign in or register to post replies

Write your reply to:

Draft