I noticed this while looking at the code to refresh my memory on how to do something today:
// Register our extension binding providers
// use converterManager as a hashTable
// also take benefit of identity converter
context
.AddBindingRule<EventGridTriggerAttribute>() // following converters are for EventGridTriggerAttribute only
.AddConverter<JObject, string>((jobject) => jobject.ToString(Formatting.Indented))
.AddConverter<string, JObject>((str) => JObject.Parse(str)) // used for direct invocation
.AddConverter<JObject, EventGridEvent>((jobject) => jobject.ToObject<EventGridEvent>()) // surface the type to function runtime
.AddOpenConverter<JObject, OpenType.Poco>(typeof(JObjectToPocoConverter<>))
.BindToTrigger<JObject>(new EventGridTriggerAttributeBindingProvider(this));
// Register the output binding
var rule = context
.AddBindingRule<EventGridAttribute>()
.AddConverter<string, EventGridEvent>((str) => JsonConvert.DeserializeObject<EventGridEvent>(str))
.AddConverter<JObject, EventGridEvent>((jobject) => jobject.ToObject<EventGridEvent>());
rule.BindToCollector(_converter);
Note how we have two entries for .AddConverter<JObject, EventGridEvent> - is there a difference in how these are utilized given one comes after registering a binding rule for a Trigger attribute, and the other comes after the Output attribute?
@watashiSHUN
I noticed this while looking at the code to refresh my memory on how to do something today:
Note how we have two entries for
.AddConverter<JObject, EventGridEvent>
- is there a difference in how these are utilized given one comes after registering a binding rule for a Trigger attribute, and the other comes after the Output attribute?If not, can one of them be safely removed?