FileWatchDependencyFactory Pennington.Infrastructure
Manages a cached service instance that auto-invalidates when watched files change.
Constructors
.ctor
#public FileWatchDependencyFactory(IFileWatcher fileWatcher, IServiceProvider serviceProvider, ILogger<FileWatchDependencyFactory<T>> logger);Initializes the factory and subscribes to file-change notifications.
Parameters
fileWatcherIFileWatcherserviceProviderIServiceProviderloggerILogger<FileWatchDependencyFactory<T>>
Methods
Dispose
#public void Dispose();Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
GetInstance
#public T GetInstance();Returns the cached instance, constructing one via DI on first access.
Returns
TInvalidateInstance
#public void InvalidateInstance();Disposes the current instance (if any) so the next call to GetInstance builds a fresh one.
Pennington.Infrastructure.FileWatchDependencyFactory
namespace Pennington.Infrastructure;
/// Manages a cached service instance that auto-invalidates when watched files change.
public class FileWatchDependencyFactory
{
/// Initializes the factory and subscribes to file-change notifications.
public FileWatchDependencyFactory(IFileWatcher fileWatcher, IServiceProvider serviceProvider, ILogger<FileWatchDependencyFactory<T>> logger);
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose();
/// Returns the cached instance, constructing one via DI on first access.
public T GetInstance();
/// Disposes the current instance (if any) so the next call to GetInstance builds a fresh one.
public void InvalidateInstance();
}