public void Deserialize()
        {
            var client = new SchemaRegistryClient(TestEnvironment.SchemaRegistryUri, TestEnvironment.Credential);

            using var memoryStream = new MemoryStream();

            #region Snippet:Deserialize
            string groupName = "<schema_group_name>";

            var serializer = new SchemaRegistryAvroObjectSerializer(client, groupName, new SchemaRegistryAvroObjectSerializerOptions {
                AutoRegisterSchemas = true
            });
            memoryStream.Position = 0;
            Employee employee = (Employee)serializer.Deserialize(memoryStream, typeof(Employee), CancellationToken.None);
            #endregion
        }
Exemple #2
0
        public void Deserialize()
        {
            using var memoryStream = new MemoryStream(_memoryStreamBytes);
            string groupName = TestEnvironment.SchemaRegistryGroup;

            #region Snippet:SchemaRegistryAvroDeserialize
            var serializer = new SchemaRegistryAvroObjectSerializer(schemaRegistryClient, groupName, new SchemaRegistryAvroObjectSerializerOptions {
                AutoRegisterSchemas = true
            });
            memoryStream.Position = 0;
            Employee employee = (Employee)serializer.Deserialize(memoryStream, typeof(Employee), CancellationToken.None);
            #endregion

            Assert.AreEqual(42, employee.Age);
            Assert.AreEqual("John Doe", employee.Name);
        }