advancedrei / sendgridplus-csharp

13 stars 7 forks source link

EventData Serialization #15

Closed toazjason closed 10 years ago

toazjason commented 10 years ago

Performing a Serialization operation on the EventData object is failing I tested this using the Newtonsoft.Json package JsonConvert.SerializeObject gives an the error "The method or operation is not implemented.".

Please add serialization support for this class.

robertmclaws commented 10 years ago

Hmm. I can add that, but what is the scenario where you are trying to re-serialize the event?

toazjason commented 10 years ago

We are implementing WebHook Events and because of the large amount of processing this can cause we are putting the event data into an Azure Message Queue for later bulk processing to the database. However before we do that I need to call GetEvents to evaluation the type of events I want to queue.

So the plan is to call GetEvents, evaluate the event type, then if its one we handle, to serialize it to a Json string for storage in the queue and then deserialize it again when we process the queue in bulk.

toazjason commented 10 years ago

Update: I discovered that the EventData is not serializing properly when there is a value in the Categories collection. Otherwise it serializes just fine.

toazjason commented 10 years ago

Another issue is that the Categories collection returns null when there is no category passed in. It should be instantiated and allow us to call Count on it to determine if it has any entries.

robertmclaws commented 10 years ago

I put out an update that takes care of both the Categories and the general serialization issue. Please let me know if you have any further problems!