ITaxonomyService.GetTaxonomyBySlug() removed, what is best practice alternative?

Topics: Core
Jul 16 at 2:34 PM
Edited Jul 16 at 2:39 PM
I'm just in the process of upgrading an old 1.8.1 Orchard project to 1.10.1 - which of course has broken some stuff.

One of the breaking changes I came across, is that the GetTaxonomyBySlug() method has been removed from ITaxonomyService in more recent versions.


I was wondering if anyone knew the reasoning as to why this was removed?

Also, what is the preferred/safest method that Orchard devs are using to obtain a specific Taxonomy in code?

There is GetTaxonomyByName(), but getting by name always seems a bit risky to me, as what if the name get's changed in the CMS? I know Slug could also be changed, but these tend to be changed less often and content managers are usually more careful around changing Slugs. Hence why I was using the BySlug method in my original code.

I guess you could use ByID, but I worry that ID can get changed when a record gets recreated in the DB, or manually recreated in CMS.

Dare I ask: is it worth considering bringing back GetTaxonomyBySlug()?
Sep 7 at 11:07 AM
Strange, I dug into this and the method is still there:

It's just not part of the interface anymore.

I don't know if it was an oversight that the method didnt get removed or if there is another reason.