Base controller method

My base controller method is not executing. Below is my base controller.

public abstract class ReportServiceBaseController : Controller { protected ReportServiceBaseController(); [HttpPost] public JsonResult LoadDocumentInfo(LoadDocumentInfoRequest request); [HttpPost] public JsonResult LoadDocumentMapInfo(LoadDocumentMapInfoRequest request); } 

Below is my derived controller:

 public class ReportController : ReportServiceBaseController { protected override PerpetuumSoft.Reporting.WebViewer.Server.ReportServiceBase CreateReportService() { return new ServiceClass(); } [HttpPost] public JsonResult LoadDocumentInfo(LoadDocumentInfoRequest request) { return base.LoadDocumentInfo(request); } } 

If I remove the LoadDocumentInfo method from the derived class, it will not receive the call. It gets called when I add a name method in a derived class

Please, help.

+2
source share
1 answer

The base class implementation is empty - but it also means that the code will not compile - since a method without an implementation should be marked as abstract .

Also, the method in your derived controller must be marked override .

Read this for reference: http://msdn.microsoft.com/en-us/library/ebca9ah3(v=vs.110).aspx

+2
source

Source: https://habr.com/ru/post/1306254/


All Articles