ObjectCreator<T> API should support release notifications back to factory implementation
- Vorherrschende Sprache
- C#
- Sterne
- 1.7k
- Forks
- 335
- Ø Merge
- 2 T. 23 Std.
- Gemergte PRs (30 T.)
- 6
Beschreibung
The current API of the ObjectCreator api only provides implementers calls to create instances. When the component instance is no longer being used by the TaskHub (e.g. it's done), we don't make this knowledge visible to the factory. When using DI containers, such as Windsor, that require release knowledge for created components we should enable their use (without resorting to hacks) by calling back to the ObjectCreator and providing the created instance. This can be done easily without breaking the existing code by implementing the additional method with a default virtual No-Op declaration.
`
///
/// Abstract class for object creation based on name and version
///
/// The type to create
public abstract class ObjectCreator : INameVersionInfo
{
///
/// The name of the method
///
public string Name { get; protected set; }
///
/// The version of the method
///
public string Version { get; protected set; }
///
/// Instance creator method
///
/// An instance of the type T
public abstract T Create();
///
/// Instance release method
///
public virtual void Release(T instance)
{
}
}
`
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Start by locating ObjectCreator and the TaskHub lifecycle path that creates and finishes component instances. Trace where Create() is called and determine where the created instance is no longer used. Done means the factory receives a release notification with that instance while existing creators remain compatible through the default no-op behavior; check the related tests or add coverage alongside the lifecycle change.
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