AdrianStrugala / AvroConvert

Rapid Avro serializer for C# .NET
Other
102 stars 27 forks source link

Add a Header #145

Closed Cutlass76 closed 4 months ago

Cutlass76 commented 8 months ago

Forgive me if this is silly question: I need to add a header to the headerless file I successfully created using the nuget package. I have a C# class (Event) that models the data. ex: namespace Cars.Models { public class CarsEvent { public Cars Cars{ get; set; } } public class Cars { public object Door{ get; set; } public string Wheels{ get; set; } = ""; public object Hood{ get; set; } } } I created the schema schema = AvroConvert.GenerateSchema(Event.GetType()); I create the avro file byte[] avroSerializedTo; avroSerializedTo = AvroConvert.SerializeHeadless(Event, schema); How do I add a header?

AdrianStrugala commented 8 months ago

Hey @Cutlass76, Would simply: avroSerializedTo = AvroConvert.Serialize(Event); work for you? Best, Adrian

github-actions[bot] commented 4 months ago

Closed due to inactivity.