Add Subtaxa exception for custom taxonomy (v5.4)

Posted by Community Admin on 04-Aug-2018 02:59

Add Subtaxa exception for custom taxonomy (v5.4)

All Replies

Posted by Community Admin on 04-Mar-2013 00:00

I just wanted to report a bug, which is a NullReferenceException on SaveChanges when adding a new Taxon to Subtaxa in a custom hierarchical taxonomy.

The workaround is to set the Taxonomy property on the new Taxon (this is not in described in the documentation examples). I experienced this problem with version 5.4.

Sample code:

teacherTaxon = taxonomyManager.CreateTaxon<HierarchicalTaxon>();
teacherTaxon.Taxonomy = teacherClassesTaxonomy; // REQUIRED
teacherTaxon.Name = teacher.Username;
teacherTaxon.Title = teacher.TeacherName;
schoolTaxon.Subtaxa.Add(teacherTaxon);
taxonomyManager.SaveChanges();

Regards,

Gary

 

This thread is closed