title: Post api in one to many relationship in EF Core 6 not inserting data to DB
body: <p>I have two models <code>Product</code> and <code>ProductTypes</code>. There is one to many relation from product to producttypes. I am using auto mapper to map data. this is what my error looks like while passing json.</p>
  <pre><code>{
    &quot;id&quot;: 0,
    &quot;name&quot;: &quot;Color&quot;,
    &quot;ProductTypeDtos&quot;: [
      {
        &quot;id&quot;: 0,
        &quot;name&quot;: &quot;Red&quot;,
        &quot;value&quot;: &quot;Red&quot;,
        &quot;createdBy&quot;: &quot;3fa85f64-5717-4562-b3fc-2c963f66afa6&quot;,
        &quot;createdDate&quot;: &quot;2022-01-06T07:51:23.312Z&quot;,
        &quot;editedBy&quot;: &quot;3fa85f64-5717-4562-b3fc-2c963f66afa6&quot;,
        &quot;editedDate&quot;: &quot;2022-01-06T07:51:23.312Z&quot;,
        &quot;ProductId&quot;:0
        &quot;ProductDtos&quot;: &quot;string&quot;
      }
    ],
    &quot;createdBy&quot;: &quot;3fa85f64-5717-4562-b3fc-2c963f66afa6&quot;,
    &quot;createdDate&quot;: &quot;2022-01-06T07:51:23.312Z&quot;,
    &quot;editedBy&quot;: &quot;3fa85f64-5717-4562-b3fc-2c963f66afa6&quot;,
    &quot;editedDate&quot;: &quot;2022-01-06T07:51:23.312Z&quot;
  }
  </code></pre>
  <p>In this it is asking for ProductDtos to be entered.</p>
  <pre><code>{
    &quot;type&quot;: &quot;https://tools.ietf.org/html/rfc7231#section-6.5.1&quot;,
    &quot;title&quot;: &quot;One or more validation errors occurred.&quot;,
    &quot;status&quot;: 400,
    &quot;traceId&quot;: &quot;00-cc22804223f60f2f5d7d9497252624a6-b543948daf6f9911-00&quot;,
    &quot;errors&quot;: {
      &quot;dto&quot;: [
        &quot;The dto field is required.&quot;
      ],
      &quot;$.producttypesDto[0].productDto&quot;: [
        &quot;The JSON value could not be converted to Highlit.Shared.Models.ProductDto. Path: $.producttypesDto[0].productDto | LineNumber: 12 | BytePositionInLine: 30.&quot;
      ]
    }
  }
  </code></pre>
  <p>and also data is not inserted into the database - how to solve this?</p>