I want to replace JSON data transmission in ASP.NET Core 8.0 MVC application with byte transmission. I chose Avro but it could also be something else.
Here is the code in my controller:
byte[] model = AvroConvert.Serialize(person, CodecType.Brotli);
return View(model);
The problem is in my .cshtml views. My @model definition now doesn't match with data:
@model PersonDTO
Without using JSON, I call view passing a byte array as model. It's possible to change deserialization system before pass data to the view?
Another idea is to create a class that inherits from RazorPage<T>:
public class CustomRazorPageModel<TModel> : RazorPage<TModel>
In this case I should define the method ExecuteAsync but I can't find any example. Usually abstract classes are created. I can follow this path too, but then would there be a method to override to modify the deserialization of the response arriving from the server?