Exemplo n.º 1
0
 /// <summary>
 /// This will serialize a datum (a single record).
 /// It does not create an Avro file container with the schema
 /// in the beginning of the file.
 /// </summary>
 private static void SerializeSingleDatumTo(string file, TransferRequest instance)
 {
     using (var stream = new FileStream(file, FileMode.Create))
     {
         var encoder = new Avro.IO.BinaryEncoder(stream);
         // The Avro.Specific namespace is for writing a single datum (no container)
         // There is the SpecificDatumWriter for writing subtypes of ISpecificRecord
         // (for example, classes from the codegen).
         // SpecificDefaultWriter can write anything.
         var writer = new Avro.Specific.SpecificDefaultWriter(instance.Schema);
         writer.Write(instance, encoder);
     }
 }
Exemplo n.º 2
0
 public SpecificWriter(SpecificDefaultWriter writer) : base(writer)
 {
 }