-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Part of #19
Overview
This issue is to track adding the ability for entity implementations to dispatch an operation to entity instance level methods or properties.
Requirements
- Entity operations can be implemented as public instance level methods or properties
- All bindings are case-insensitive
- Properties: not dispatched to.
- We do not want to conflate entity serialized state and operations, so we will not dispatch to properties.
- Methods: will look for a method matching operation name
- Will examine method parameters and bind appropriately
Non-Requirements
- Support for
Task,Task<T>,ValueTask, orValueTask<T>- We need to further examine if it makes sense for entities to have any async support
- Dispatching to non-
ITaskEntitytypes
Design
We will introduce a base class TaskEntity : ITaskEntity which will perform mapping from the operation payload to an appropriate instance-level property or method.
Method Binding
Parameter support
The below table is what parameters we support and what we will bind. We will only bind one of these parameters once. Any unsupported parameter types or already bound parameter types will cause an exception to be thrown.
| Param type | Action |
|---|---|
| Entity context | Bind current entity context |
| Entity operation | Bind current entity operation |
object |
Bind from operation input |
Return value support
We will return the value of the bound method, if any, to the caller. We will not support async dispatching (so no Task or ValueTask) at this time.
Overload resolution
We will throw on any discovered overloads with an ambiguous operation exception.