AvroHelper.Generators
1.0.0
Upgrade to 1.0.1 or higher
See the version list below for details.
dotnet add package AvroHelper.Generators --version 1.0.0
NuGet\Install-Package AvroHelper.Generators -Version 1.0.0
<PackageReference Include="AvroHelper.Generators" Version="1.0.0" />
paket add AvroHelper.Generators --version 1.0.0
#r "nuget: AvroHelper.Generators, 1.0.0"
// Install AvroHelper.Generators as a Cake Addin #addin nuget:?package=AvroHelper.Generators&version=1.0.0 // Install AvroHelper.Generators as a Cake Tool #tool nuget:?package=AvroHelper.Generators&version=1.0.0
AvroHelper
Source generator to make implementing ISpecificRecord less of a pain.
Usage
Install NuGet package
dotnet add package AvroHelper.Generators
Apply attribute to your partial class
Any property with an AvroColumnAttribute
will be included in mapping.
using AvroHelper
[GeneratedAvroRecord]
public partial class MyRowDto
{
public string SomeId { get; set; }
[AvroColumn(0, ColumnName = "some_RiDiCuLoUs_name")]
public string SensibleName { get; set; }
[AvroColumn(0, ColumnName = "DATE_COLUMN", UnderlyingType = "int", LogicalType = "date")]
public DateTime? DateColumn { get; set; }
}
The souce generator will implement ISpecificRecord with implementations of the Schema, Get, and Put. It will only add the Schema if your class does not already have a Schema Get method, so if you don't want to use the generator's schema, just implement that yourself.
var datumReader = new SpecificDatumReader<MyRowDto>(schema, schema);
using var stream = avroRows.SerializedBinaryRows.Memory.AsStream();
var decoder = new BinaryDecoder(stream);
while (stream.Position < stream.Length)
{
var @record = datumReader.Read(null!, decoder);
yield return @record;
}
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- AvroHelper (>= 1.0.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.3.1)
- System.Text.Json (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.