odata – Constructing or initializing instances of the type with the expression ( == null) is not supported

I am accessing OData API using ODataConnectedService.

When I use this code;

UpcomingJobsItems = context.EventStaffRequired
  .Select(c => new UpcomingJob
  {
     EventType = c.Event.EventType == null ? "" : c.Event.EventType.Type,
  });

I am getting below error;

System.NotSupportedException: ‘Constructing or initializing instances
of the type UpcomingJob with the expression (c.Event.EventType ==
null) is not supported.’

If I don’t check for null I get error on null values. How can I handle null values in this case?

Thanks

Regards

Read more here: Source link