Custom attributes for Sitefinity Taxa

November 01, 2012
Are your taxa too dumb?...want to give them some more data other than just description and synonyms?

Well telerik thought you might, so the API is there...they just aren't using it yet :)

I had a whole system of persisting values into the taxa description field via JSON, and it worked well...but in browsing the DB one day I noticed the table "sf_taxa_attrbutes".  The table contains 3 columns, taxaid, key, value (so a dictionary).

I put in a ticket, and support wizard Jen Peleva asked around and turns out it literally is almost exactly what I was doing with JSON...and there's an API for it! (Confirmed future-safe by Boyan too)

Check this out:
var tManager = TaxonomyManager.GetManager();
var tags = tManager.GetTaxa<FlatTaxon>().Where(t => t.Title.Contains("a")).SingleOrDefault();
tags.Attributes.Add("test", "value");
var getAttr= tags.Attributes;

So in my case, I want to link imageIds, and other meta-data to taxa...and this is exactly what will let me do it :)

Enjoy extending your taxa!
Steve



Image Description

Steve McNiven-Scott

Best\Only Blogger on this site. Therefore defacto blogger of the year Award Winner.