Proposal: introduce `INameVersionProvider`
- Dominant language
- C#
- Stars
- 1.7k
- Forks
- 335
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 6
Description
### Background
I am working on enabling open-generic orchestrations and activities in DTFx. This will allow for registering an open generic to the TaskHubWorker (ie: `MyTaskActivity`) and being able to schedule closed generic versions of it (`context.ScheduleTask(typeof(MyTaskActivity), "some input");`). I have it working for the most part, just the overloads where DTFx takes in the type and uses `NameVersionHelper.GetDefaultName(object obj)` does not work - as this uses `Type.ToString()` when I need `Type.FullName`. The difference between the two is `FullName` will include assembly info in the generic arguments, which is essential for loading that type in the worker.
### Proposal
1. Introduce a new interface:
``` CSharp
public interface INameVersionProvider
{
string GetName(object obj, bool useFullyQualifiedMethodNames = false);
string GetVersion(object obj);
}
```
2. Plum that interface through all places where `NameVersionHelper` is used.
- `TaskHubClient` and `TaskHubWorker` should accept this interface - either a ctor overload or a public property.
- The provider supplied to the `TaskHubWorker` should flow in to the `OrchestrationContext` and also be used there.
- Supplying this will be optional.
3. When not supplied, `NameVersionHelper` will be used instead.
The goal will be to introduce no break changes and make this interface entirely optional - so users will only see a different behavior if they opt to supply a custom `INameVersionProvider`.
I have a PR nearly ready for this - will put it up soon.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.