Apache Avro for c# vs Microsoft.Avro.Core
Asked Answered
B

2

9

I am new to avro and am trying to implement avro schema serialization in a new project. I saw that there are two different NuGet packages available and was wondering what the differences between both were.

  1. Microsoft's version: https://github.com/welly87/Apache-Avro-Core (couldnt find any documentation for this except for the hadoop and azure version)
  2. Apache's version 1.7.7.2 :https://avro.apache.org/docs/1.7.7/api/csharp/index.html

Also are there any available examples to look at how serialization is done or best practices for avro serialization in c# given any generic schema. I see a lot of info for java but barely any for c#. Which of the two is it the wisest to use?

Belton answered 17/10, 2017 at 22:3 Comment(1)
I am also after this, the landscape is a right ol' mess... did you ever get any proper answers? The main thing I'm struggling with is how to embed a schema.. if you need to?!Gainly
D
2

It appears the the Microsoft.Avro.Core package is no longer in pre-release and you can find the source at the microsoft-avro repository.

There is currently not a lot of documentation, but there are quite a few unit tests you can glean usage from.

Specifically, take a look at the AvroContainerTests, there are tests that show reading/writing using both the Microsoft types and Apache types.

The original announcement stated "The library can generate portable files with embedded schema. The file format is compatible with Avro container file specification and can be used across platforms", so for embedded schema you will want to use the AvroContainer.

There is also the Official Sample Test you can use as a starting point.

Dania answered 22/11, 2019 at 23:55 Comment(0)
D
1

It's not an answer, but can't add comments due to rep
There is some examples for microsoft version: https://learn.microsoft.com/en-us/azure/hdinsight/hdinsight-dotnet-avro-serialization#sample-5-serialization-using-object-container-files-with-a-custom-compression-codec

Divisor answered 19/10, 2017 at 8:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.