且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在MVC中使用单个控制器编写服务

更新时间:2023-02-13 08:14:07

编写context.SaveChanges所在的服务并从控制器调用该服务。

这也会减少耦合。有一个Add实体方法和Context.SaveChanges()一次

希望这有帮助

谢谢

:)
You write the service where the context.SaveChanges would be present & get that service called from your controller.
This will also reduce coupling. Have the Add entity method and Context.SaveChanges() once
Hope this helps
Thanks
:)