Skip to content

Add method dispatching TaskEntity base class#171

Merged
jviau merged 6 commits intomicrosoft:feature/entitiesfrom
jviau:entities-2
Aug 8, 2023
Merged

Add method dispatching TaskEntity base class#171
jviau merged 6 commits intomicrosoft:feature/entitiesfrom
jviau:entities-2

Conversation

@jviau
Copy link
Member

@jviau jviau commented Jul 27, 2023

resolves #164

Adds a TaskEntity abstract class which can be used for implementing entities where all public methods are considered operations.

What is supported?

Customers can derive from TaskEntity and add public methods to their type which will be considered operations. These public methods work as follows:

  1. The return value is the response to the operation caller (if available)
  2. input, entity context, and entity operation are supported as parameters.
  3. Default values for the input parameter is supported.
  4. The input parameter does not need to be called input. It is defined as any parameter which does not match TaskEntityContext or TaskEntityOperation.
  5. Bound parameters cannot be duplicate, meaning a max of 3 parameters and only 1 of each can match input, context, and operation.
  6. Methods cannot return Task or ValueTask (until we determine this support is needed).
    1. Added this restriction as I am unsure how an async entity would even behave, given the current implementation in DF is based on orchestrations.

@sebastianburckhardt
Copy link
Member

Methods cannot return Task or ValueTask (until we determine this support is needed)

I think we need to support this. It is very common for entity operations to perform I/O and restricting our users to do synchronous I/O is pretty terrible (in fact, synchronous I/O is "forbidden" in some contexts).

Copy link
Member

@sebastianburckhardt sebastianburckhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor suggestions, looks good overall.

@jviau
Copy link
Member Author

jviau commented Aug 8, 2023

I think we need to support this. It is very common for entity operations to perform I/O and restricting our users to do synchronous I/O is pretty terrible (in fact, synchronous I/O is "forbidden" in some contexts).

Ah okay, so we do allow for yielding of the thread in an entity. Good to know. Will add that support.

@jviau jviau merged commit 16a5d04 into microsoft:feature/entities Aug 8, 2023
@jviau jviau deleted the entities-2 branch August 8, 2023 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants