I am getting this error message System.NotSupportedException: Deserialization of interface types is not supported.
while calling an API which taken request as per below.
example
[HttpPost]
public IActionResult AddSomeData(MyClass MyClass)
{
return Ok();
}
public class MyClass : MyInterface
{
return Ok();
}
public interface MyInterface
{
public string SomeOtherProperties { get; set; }
public MyInterface Property { get; set; } //Or reference of any other interface
}
I have tried examples given online, Like creating Concrete Class and adding attribute over the property. But it is not helping out.
As workaround I have removed public MyInterface Property { get; set; } and added public MyClass Property { get; set; }
Any better solution for this?