Samples

Small console programs that show AvroSharp's main APIs end to end. Run one with dotnet run --project samples/<name>. CI runs each on every build, and each checks its own results, so they stay in step with the code.

Sample Shows
GettingStarted Parsing a schema, writing and reading a GenericRecord, reading data as a newer schema version, JSON (GenericDatumJsonWriter), fingerprints (AvroSchema.Fingerprint64)
ContainerFiles Writing and reading .avro files with the generic model: codecs and their sizes, header metadata, asynchronous reading, and reading as a newer schema. The code of Container files
SchemaEvolution Reading data written with one schema version as another: added and removed fields, promotions, aliases, enum defaults, nullable fields, and the pairs that fail. The code of Schema evolution
LogicalTypes Dates, times, timestamps, decimals and UUIDs, as generated types and in the generic model, with precision and range checks. The code of Logical types
Json Avro's JSON encoding: how it differs from plain JSON, converting between binary and JSON, and reading JSON of an older schema. The code of JSON
GeneratedTypes C# types generated from a schema file with logical types, a zstandard container file (AvroFileWriter, ZstandardCodec), reading every codec (AvroCodecs.All), and reading a file an older schema version wrote
GeneratorPackage What an application writes to use the AvroSharp.Generators package: the project file, the MSBuild settings, schemas across files, and how to use the generator from source instead
SerializableTypes Your own C# types with [AvroSerializable]: the schema the generator builds from them (camelCase field names, a nested record, an enum, a union of records), a container file, reading data an older version wrote, and lookup by type with AvroTypes
Messaging Single-object messages with a schema store (AvroMessage, AvroSchemaStore), Confluent schema-registry framing with an ID resolver (AvroRegistryMessage, IAvroSchemaIdResolver), and a stream of objects without a container (AvroStreamWriter, AvroStreamReader)
Migration Apache.Avro code and the same with AvroSharp, each reading what the other wrote: schemas and fingerprints, the generic model, resolution, container files, generated types in the Apache.Avro compatibility mode, and exceptions (AvroSchemaException, AvroDataException). It holds the code of the migration guide
Confluent Kafka with Confluent Schema Registry through AvroSharp.Confluent: producing [AvroSerializable] orders, and consuming them as the same type, as generic values (AvroSharpGeneric) and as a newer version of the type. It needs a broker and a registry: docker compose up -d --wait in its folder starts Redpanda (compose.yaml)
KafkaFlowEvents KafkaFlow with Confluent Schema Registry through AvroSharp.KafkaFlow: two [AvroSerializable] event types on one topic, each under its own subject (TopicRecord), produced with KafkaFlow's producer and handled by a typed handler per type. It uses the Confluent sample's Redpanda: docker compose up -d --wait in Confluent

The samples use the source generator from this repository (build/UseLocalGenerator.targets), so CI tests the current code. An application references the AvroSharp.Generators package instead, as GeneratorPackage shows; its project file reads like an application's, and Directory.Build.targets swaps the package for the source here.