4.1 upgrade - Taxon querying problem - Bugs & Issues - Bugs & Issues - Progress Community
 Bugs & Issues

4.1 upgrade - Taxon querying problem

  • 4.1 upgrade - Taxon querying problem
  • Hello, I've got following problem. In Sitefinity 4.0 I used this code to select single taxon.

    var taxonomyManager = TaxonomyManager.GetManager();
    var taxon = taxonomyManager
        .GetTaxa<FlatTaxon>()
        .Where(tx => tx.Taxonomy.Name == taxonomyName)
        .Where(tx => tx.UrlName == taxonUrlName)
        .SingleOrDefault();

    When specified existing taxonomy name and taxon url name this code returned single taxon. Unfortunetely after upgrade to 4.1 it always returns null. I made some research and figured out that folowing code does work.

    var taxonomyManager = TaxonomyManager.GetManager();
    var taxonsList = taxonomyManager
        .GetTaxa<FlatTaxon>()
        .Where(tx => tx.Taxonomy.Name == taxonomyName)
        .ToList();
     
    foreach (var t in taxonsList)
        if (t.UrlName == taxonUrlName)
            // do something

    Please explain if there is something wrong with my code or is it problem caused by Sitefinity upgrade.
  • Hope, I will have not this issue because i use a lot of this type of queries for a website.

    Upgrade to 4.1 is already complicated with many bugs, i don't need this one.

    Jocelyn
  • Hello michiz,

    This is very strange. Is it possible that you have been mistaken somehow? We tested with exactly the same code as you and it works fine. Can you try again? If it is still reproducible, can you send us the project so we could investigate it locally?

    Regards,
    Vlad
    the Telerik team

  • Unfortunately I still use workaround solution. There is one thing, which I noticed. When selecting taxons filtered by Name I get correct results.

    taxonomyManager
     .GetTaxa<FlatTaxon>()
     .Where(tx => tx.Name == "something")
     .ToList();

    On the other hand when I filter taxons by Title or UrlName, NewsManager returns empty result. The Name attribute type is string. The Title and UrlName attributes type is Telerik.Sitefinity.Model.Lstring. Could it be the reason of this problem?
  • Hi michiz,

    We managed to reproduce the problem - it occurs in multilingual mode, however seems it is not a common LINQ issue in multilingual, because it works fine for some other queries which have Lstring properties. We will investigate the problem further and will let you know about the result.

    All the best,
    Vlad
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Thank you for response. I look forward for problem resolution.

    Regards
    michiz
  • Hi michiz,

    Here is some update.

    In the meantime, you can use the following alternative and better workaround:

    ar taxonomyManager = TaxonomyManager.GetManager();
    var taxon = taxonomyManager
        .GetTaxa<FlatTaxon>()
        .Where(tx => tx.Taxonomy.Name == taxonomyName)
        .Where(tx => tx.UrlName[""] == taxonUrlName)
        .SingleOrDefault();

    Specifying tx.UrlName[""] in the expression means that your query will by filtered by invariant value of the UrlName property.


    Kind regards,
    Vlad
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hello michiz,

    This issue is addressed in the latest release (Sitefinity 4.1 SP1).

    Best wishes,
    Vlad
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items