Can an ApiController return an object with a collection of other objects?

前端 未结 2 1432
囚心锁ツ
囚心锁ツ 2021-01-06 20:40

If I have a Customer class that just has simple properties (e.g. Name, etc.) then I can create a CustomersController that derives from

2条回答
  •  时光说笑
    2021-01-06 20:59

    You are passing an Entity Framework entity which will cause problems. You need Data Transfer Objects to pass and receive your data. Because you bind entities together, it won't allow you to serialize the data.

提交回复
热议问题