Global.asax ファイルで構成されているカスタム モデル バインダーを使用しました。アプリケーションの特定の領域でのみこのモデル バインダーを使用することは可能ですか?
public class CreatorModelBinder : IModelBinder
{
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
//what logic can i put here so that this only happens when the controller is in certain area- and when it's not in that area- then the default model binding would work
var service = new MyService();
if (System.Web.HttpContext.Current != null && service.IsLoggedIn)
return service.Creator;
return new Creator {};
}
}