Generic Web Api controller to support any model

后端 未结 7 773
南旧
南旧 2020-11-30 09:43

Is it possible to have a generic web api that will support any model in your project?

class BaseApiController :ApiController
{
    private IReposito         


        
相关标签:
7条回答
  • 2020-11-30 10:37

    It's definitely possible. I've never had a reason to do that before, but if it works for your situation, it should be good.

    If all of your models can be saved and retrieved in the exact same way, maybe they should just all be in the same controller instead though?

    0 讨论(0)
提交回复
热议问题