Skip to content

Commit 0c642e8

Browse files
committed
fix ServiceRunner signatures
1 parent 9eb8497 commit 0c642e8

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

MyApp/_pages/api-design.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,20 +797,20 @@ Where `MyServiceRunner<T>` is just a custom class implementing the custom hooks
797797
```csharp
798798
public class MyServiceRunner<T> : ServiceRunner<T>
799799
{
800-
public override void OnBeforeExecute(IRequest req, TRequest requestDto) {
800+
public override OnBeforeExecute(IRequest req, TRequest request, object service) {
801801
// Called just before any Action is executed
802802
}
803803

804-
public override Task<object> ExecuteAsync(IRequest req, object serviceInstance, TRequest requestDto) {
804+
public override Task<object> ExecuteAsync(IRequest req, object instance, TRequest requestDto) {
805805
// Called to execute the Service instance with the requestDto
806806
return base.ExecuteAsync(req, serviceInstance, requestDto);
807807
}
808808

809-
public override object OnAfterExecute(IRequest req, object response) {
809+
public override object OnAfterExecute(IRequest req, object response, object service) {
810810
// Called just after any Action is executed, you can modify the response returned here as well
811811
}
812812

813-
public override Task<object> HandleExceptionAsync(IRequest req, TRequest requestDto, Exception ex) {
813+
public override Task<object> HandleExceptionAsync(IRequest req, TRequest requestDto, Exception ex, object instance) {
814814
// Called whenever an exception is thrown in your Services Action
815815
}
816816
}

MyApp/_pages/customize-http-responses.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,22 +287,20 @@ Where `MyServiceRunner<T>` is just a custom class implementing the custom hooks
287287
```csharp
288288
public class MyServiceRunner<T> : ServiceRunner<T>
289289
{
290-
public override void OnBeforeExecute(
291-
IRequest requestContext, TRequest request)
292-
{
290+
public override OnBeforeExecute(IRequest req, TRequest request, object service) {
293291
// Called just before any Action is executed
294292
}
295293

296-
public override object OnAfterExecute(
297-
IRequest requestContext, object response)
298-
{
299-
// Called just after any Action is executed.
300-
// You can modify the response returned here as well
294+
public override Task<object> ExecuteAsync(IRequest req, object instance, TRequest requestDto) {
295+
// Called to execute the Service instance with the requestDto
296+
return base.ExecuteAsync(req, serviceInstance, requestDto);
301297
}
302298

303-
public override object HandleException(
304-
IRequest requestContext, TRequest request, Exception ex)
305-
{
299+
public override object OnAfterExecute(IRequest req, object response, object service) {
300+
// Called just after any Action is executed, you can modify the response returned here as well
301+
}
302+
303+
public override Task<object> HandleExceptionAsync(IRequest req, TRequest requestDto, Exception ex, object instance) {
306304
// Called whenever an exception is thrown in your Services Action
307305
}
308306
}

MyApp/_pages/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ public class MyServiceRunner<T> : ServiceRunner<T>
405405
public MyServiceRunner(IAppHost appHost, ActionContext actionContext)
406406
: base(appHost, actionContext) {}
407407

408-
public override object HandleException(IRequest request,
409-
T request, Exception ex) {
408+
public override Task<object> HandleExceptionAsync(IRequest req, TRequest requestDto,
409+
Exception ex, object service) {
410410
// Called whenever an exception is thrown in your Services Action
411411
}
412412
}

0 commit comments

Comments
 (0)