Proposal: introduce `INameVersionProvider`
- Vorherrschende Sprache
- C#
- Sterne
- 1.7k
- Forks
- 335
- Ø Merge
- 2 T. 23 Std.
- Gemergte PRs (30 T.)
- 6
Beschreibung
### 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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne damit, die Stellen nachzuverfolgen, an denen NameVersionHelper verwendet wird, insbesondere TaskHubClient, TaskHubWorker und OrchestrationContext. Überprüfe, wie diese Komponenten das Benennungsverhalten akzeptieren und weitergeben, und stelle anschließend sicher, dass ein optionaler INameVersionProvider bereitgestellt werden kann, ohne das bestehende Verhalten zu ändern, und dass der Provider des Workers den OrchestrationContext erreicht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp
- Bereich
- backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100