Getting access to Tag Service from Module

Topics: General, Writing modules
Oct 19, 2012 at 6:33 AM

What's the best way to get access to the tag service from a custom module?

I want to be able to grab a content item based on a tag.

I've looked around and most of the stuff I've seen is snippets about how to get the TagPartRecord - which gets me the ID that I need to pull the TagRecord - which would then give me the content item id; but not sure how to-do that from ContentManager - so I'm wondering if I should do this from the Tag Service.

How would either be accomplished?


Oct 19, 2012 at 7:17 AM

WOW - I never realized it; but I didn't know you could just add arguments to the constructor of your service to pull what you want.

So anyone that may not know - I just added ITagService to my ctor for my service module and I now have it.

I'm not sure this is actually documented like this - is it?


Oct 19, 2012 at 8:43 AM

The documentation will probably be updated for 1.7, which hopefully will make it easier to find info like this. It is however documented, here on how Orchard Works.

Oct 19, 2012 at 3:29 PM