Using inherited classes in .NET web API POST/PUT method
问题 I can't figure out how I can work with inherited classes in an web API controller. I have to create only one API controller to create and update inherited objects in the database. Similar to my models (to all these models exists a Dto): public class Animal { public virtual string Name {get; set;} // e.g. Harry public virtual string Type {get; set;} // e.g. Dog } public class AnimalDto { public string Name; public Type Type; } public class Dog : Animal { public virtual bool CanBark {get; set;}