Home > Blockchain >  Automapper ProjectTo is not mapping JsonB ColumnType of POCO Object
Automapper ProjectTo is not mapping JsonB ColumnType of POCO Object

Time:01-01

I am using EF Core 6 with the Npgsql Entity Framework Core Provider. I have a table with a column type of jsonb mapped to a POCO object. If I query the database and use Automapper to ProjectTo, the property is empty. If I use Automapper to Map the object is populated properly.

The jsonb column is a list of POCO objects and I'm mapping to a RepeatedField, list of objects of same type.

Here is a working DotNetFiddle:

https://dotnetfiddle.net/WlrnIQ

CodePudding user response:

Because the property you're looking to be populated by AutoMapper doesn't have a setter:

public pbc::RepeatedField<global::ProtocolBuffers.Protos.Configuration.Api.OptionsDefinitionModel> OptionDefinitions
{
    get { return optionDefinitions_; }
}
  • Related