ObjectCreator<T> API should support release notifications back to factory implementation
- Dominant language
- C#
- Stars
- 1.7k
- Forks
- 335
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 6
Description
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)
{
}
}
`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.