in src/DotPulsar/Schemas/AvroISpecificRecordSchema.cs [155:186]
private static object LoadSpecificDatumWriter()
=> Activator.CreateInstance(_avroWriterTypeInfo, _avroSchema) ?? throw new SchemaException("Could not create SpecificDatumWriter");
private static object LoadSpecificDatumReader()
=> Activator.CreateInstance(_avroReaderTypeInfo, _avroSchema, _avroSchema) ?? throw new SchemaException("Could not create SpecificDatumReader");
private static MethodInfo LoadSpecificDatumReaderMethod(IEnumerable<MethodInfo> methods)
{
const string name = "Read";
const string secondParamFullname = "Avro.IO.Decoder";
foreach (var method in methods)
{
if (method.Name != name || method.ReturnType != typeof(T))
continue;
var parameters = method.GetParameters();
if (parameters.Length != 2)
continue;
var param1Fullname = parameters[1].ParameterType.FullName;
if (param1Fullname is null)
continue;
if (parameters[0].ParameterType != typeof(T) || !param1Fullname.Equals(secondParamFullname))
continue;
return method;
}
throw new SchemaException($"A method with the name '{name}' matching the delegate was not found");
}