How to make it deserialize to original type? WebJobs SDK allows to specify the type of a POCO object and add QueueTriggerAttribute
near it to make it function (the doc). Now it deserializes not to an original type but some other (from run to run it varies). Here is the code:
public class PocoCommandA { public string Prop { get; set; } }
public class PocoCommandB { public string Prop { get; set; } }
public static void Func1([QueueTrigger("myqueue")] PocoCommandA aCommand)
{... }
public static void Func2([QueueTrigger("myqueue")] PocoCommandB bCommand)
{ ... }
And it calls Fun2
(or some other) when
var a = new PocoCommandA();
var cloudQueueMessage = new CloudQueueMessage(JsonConvert.SerializeObject(a));
await queue.AddMessageAsync(cloudQueueMessage);