【发布时间】:2013-05-19 16:30:35
【问题描述】:
我对以下控制器操作有一些疑问(在 ASP.NET MVC 中,但这是一个更通用的问题):
public ActionResult DoSomething( int id, IUser currentUser )
{
var myDomainObject = businessService.GetDomainObjectById( id );
if( !securityService.CurrentUserCanAcess( currentUser, myDomainObject ) )
{
throw new HttpException(403, "forbidden");
}
if( workflowService.IsWorkflowFinishedFor( myDomainObject ) )
{
return RedirectToAction( "OtherAction", identifier );
}
var myModel = entityToModelMapper.GetModel( myDomainObject );
return View( myModel );
}
workflowService、securityService、businessService 和 entityToModelMapper 都通过 IoC 注入到我的控制器中。
我担心在同一个控制器操作中涉及安全、业务和工作流。可以吗?
【问题讨论】:
标签: asp.net-mvc model-view-controller architecture