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

Topics: Core
Jul 16 at 3:34 PM
Edited Jul 16 at 3: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.

See https://github.com/OrchardCMS/Orchard/commit/9f84c29e39cf1253ae825fed9af7f8a3c1de16bd

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 12:07 PM
Strange, I dug into this and the method is still there:

https://github.com/OrchardCMS/Orchard/blob/1.10.1/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TaxonomyService.cs#L83

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.