TypePartEditorUpdate - get type name

Topics: General, Writing modules
Aug 8, 2013 at 11:19 AM
Does anyone know if it is possible to get the TypeName from within this method, my method looks like -
 public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(
    ContentTypePartDefinitionBuilder builder,
    IUpdateModel updateModel) {
    if (builder.Name != "ProductOptionPart")
        yield break;

    var model = new ProductOptionTypePartSettings();
    updateModel.TryUpdateModel(model, "ProductOptionTypePartSettings", null, null);
    builder.WithSetting("ProductOptionTypePartSettings.FieldsToAppendToDescription", model.FieldsToAppendToDescription);

    yield return DefinitionTemplate(model);
nothing unusual here, but after the tryupdatemethod, i want to look through all of the these content types and update something, if I could get the Type Name I am in business but can't seem to figure out how to get it.
I've looked in other modules, but everything I have looked at so far doesnt do anything like this.

Any ideas? Or is there a more elegant way maybe?

Aug 8, 2013 at 11:46 AM
Right, think I have sussed it.
I added the following
        public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition) {
            var model = definition.Settings.GetModel<ProductOptionTypePartSettings>();
            _contentTypeName = definition.Name;
            yield return DefinitionTemplate(model);
I also added a private string to my class called _contentTypeName.
As this method gets called on edit and update, it gets populated, and thus contains my type name in The TypePartEditorUpdate method

Found a sample in the Orchard.Indexing module, in the EditorEvents class