private bool InvokePostConverter(object instance, PropertyBag bag) { Type instanceType = instance.GetType(); if (converters.ContainsKey(instanceType)) { IPropertyBagPostConverter converter = converters[instanceType]; converter.ApplyConversion(instance, instanceType, bag.Properties); return(true); } else { return(false); } }
/// <summary> /// Adds a custom converter that resolves differences when converting an event or command with /// an earlier schema. /// </summary> /// <param name="targetType">The type of command or event for which to a add custom post conversion.</param> /// <param name="converter">The converter object that will resolve the differences.</param> public void AddPostConversion(Type targetType, IPropertyBagPostConverter converter) { _converters[targetType] = converter; }
/// <summary> /// Adds a custom converter that resolves differences when converting an event or command with /// an earlier schema. /// </summary> /// <param name="targetType">The type of command or event for which to a add custom post conversion.</param> /// <param name="converter">The converter object that will resolve the differences.</param> public void AddPostConversion(Type targetType, IPropertyBagPostConverter converter) { converters[targetType] = converter; }