I am having some issues integrating some Protobuf message generated C# classes with Entity Framework Core. I am able to use the protobuf generated classes in most cases to store information correctly into both sqlite and mysql databases. The issue comes when the protobuf message uses a repeated variable. I am able to store the repeated field into the database by serialising to a list of strings but when trying to read back from the database I get this error.
Unhandled Exception: System.InvalidOperationException: No backing field could be found for property '<propertyname>' of entity type '<entityname>' and the property does not have a setter.
From searching it seems that a design decision was made that when generating the protobuf class that repeated fields should not have a setter method only a get and this is causing issues when the Entity framework based functions are trying to write the parsed result back into the repeated field variable.
I was wondering if anyone has any ideas of potential ways to work around this issue of not having a setter within the Entity Framework or if there is a better way to achieve this type of functionality of storing Protobuf generated messages into databases.
For reference I have the entity property setup like this currently:
entity.Property(e => e.StationTypes)
.HasConversion(
types => types.ToString(),
column => ConvertToRepeatedField(column)
);
Where the data is written as a JSON style string into the database and then Converted back into a repeated field using the custom conversions.
Thanks For any help in advance.
Edit: Currently using the Google.Protobuf (3.6.1) Library