Skip to content

POST with nested properties #920

@BpStef

Description

@BpStef

I'm trying to do a POST with the Simple OData Client to my API but when we try to do this I get:
'The property 'Producer' does not exist on type 'Waste.QualificationsCore.API.Interface.OData.Qualifications.QualificationDto'. Make sure to only use property names that are defined by the type or mark the type as open type.'

The code the POST is:
return await _client.For<QualificationDto>(ODataPath(Paths.ODataV1Qualifications)) .Set(request) .InsertEntryAsync(token);

The DTO I'm trying to add is:
` public class QualificationDto
{
[Key]
public Guid QualificationId { get; set; }

	[NonFilterable]
	[NotFilterable]
	public DateTime? DocumentDate { get; set; }

	[NonFilterable]
	[NotFilterable]
	public DateTime? ExpiryDate { get; set; }

	public string IdentificationCode { get; set; }

	[AutoExpand]
	public ProducerDto Producer { get; set; }

}`

The Producer is a reference to an object in another datasource so I want to show it as an seperate object and not an ID. (e.g. Owned type on EF).

How can I fix/do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions