OperationServiceExtensionsRegisterExternalOperationTRequest, TResponse Method |
Exposes a custom operation to be available for call by other plugins. The registration is not permanent, it holds true until disposing the return value, or plugin shutdown.
Namespace:
Resto.Front.Api.Extensions
Assembly:
Resto.Front.Api.V6 (in Resto.Front.Api.V6.dll)
Syntaxpublic static IDisposable RegisterExternalOperation<TRequest, TResponse>(
this IOperationService operationService,
string serviceName,
string operationName,
Func<TRequest, TResponse> callback,
SerializationBinder binder = null,
ISurrogateSelector surrogateSelector = null
)
Parameters
- operationService
- Type: Resto.Front.ApiIOperationService
Operation service. - serviceName
- Type: SystemString
Identifies the external service, just a namespace for a set of interrelated operations, which helps to group them logically. It's recommended to choose a unique name to avoid collisions with other plugins, i.e. include company's name or plugin's name into the service name. Min length is 1, max length is 50 chars.
- operationName
- Type: SystemString
In aggregate with serviceName identifies the operation. Both names have to be pre-shared with consumer plugins, so that they will be able to call the operation referring it by service and operation name. The combination of a service name and operation name must be unique at the same time. Min length is 1, max length is 50 chars.
- callback
- Type: SystemFuncTRequest, TResponse
The operation implementation, which will be called by other plugins via CallExternalOperationTRequest, TResponse(IOperationService, String, String, TRequest, SerializationBinder, ISurrogateSelector).
- binder (Optional)
- Type: System.Runtime.SerializationSerializationBinder
A serialization binder for custom mapping between types and names. Default is null. - surrogateSelector (Optional)
- Type: System.Runtime.SerializationISurrogateSelector
The ISurrogateSelector to use for serialization. Default is null.
Type Parameters
- TRequest
- TResponse
Return Value
Type:
IDisposableUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IOperationService. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks
Different plugins running under the same iikoFront application instance can communicate via external operations. iikoFront just transfers requests and responses between plugins without knowing any details. Both producer and consumer plugins should understand the data structure, developers should negotiate a protocol specification, pre-share operation names, handle versioning and so on. Producer plugin registers an operation using
RegisterExternalOperationTRequest, TResponse(IOperationService, String, String, FuncTRequest, TResponse, SerializationBinder, ISurrogateSelector) and consumer plugin call it using
CallExternalOperationTRequest, TResponse(IOperationService, String, String, TRequest, SerializationBinder, ISurrogateSelector).
See Also