Skip to content

iron9light/CloudNative.CloudEvents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extensions for CloudNative.CloudEvents

Build Status Lines of Code Coverage Reliability Rating Security Rating

CloudNative.CloudEvents.AzureServiceBus

Azure ServiceBus extension for CloudNative.CloudEvents

NuGet

CloudNative.CloudEvents.Json

The features provide by this package have been implemented officially after version 2.0. Please use CloudNative.CloudEvents.NewtonsoftJson.

Generic Json extension for CloudNative.CloudEvents

NuGet

var jsonSerializerSettings = new JsonSerializerSettings
{
    DateParseHandling = DateParseHandling.DateTimeOffset,
    DateTimeZoneHandling = DateTimeZoneHandling.Utc,
};
var formatter = new JsonCloudEventFormatter<MyData>(jsonSerializerSettings); // JsonSerializerSettings is optional
var cloudEvent = formatter.DecodeStructuredEvent(jsonData);
cloudEvent.Data.Should().BeOfType<MyData>(); // The type of Data is MyData type, but not JToken

Notice

The attribute value may be a DateTimeOffset if the JsonSerializerSettings.DateParseHandling is DateParseHandling.DateTimeOffset. But the attribute value for time will always be DateTime.

About

Extensions for CloudNative.CloudEvents

Resources

License

Stars

Watchers

Forks

Languages