Class FunctionPathProvider
- Namespace
- Invex.FileSystem
- Assembly
- Invex.FileSystem.dll
A lightweight, delegate-based implementation of IPathProvider that resolves paths using a caller-supplied function rather than requiring a dedicated class.
public sealed class FunctionPathProvider : IPathProvider
- Inheritance
-
objectFunctionPathProvider
- Implements
Remarks
Use FunctionPathProvider (or the ProvidePath extension in
FileSystemHostExtensions) when path logic is simple enough to express inline
rather than in a separate class. For complex resolution logic — such as searching the file
system or combining multiple keys — a dedicated IPathProvider implementation
is clearer.
Constructors
FunctionPathProvider()
public FunctionPathProvider()
Properties
Priority
Gets the priority of this provider.
public required int Priority { get; init; }
Property Value
- int
Remarks
Higher values are queried before lower values. When two providers can both resolve the same key the one with the higher priority wins. Use a negative value to register a low-priority fallback that only applies when no other provider matches.
Provider
Gets the delegate that implements the path resolution logic.
public required Func<string, RootedPath?> Provider { get; init; }
Property Value
- Func<string, RootedPath>
Remarks
The delegate receives the key string and should return a RootedPath when it
recognizes the key, or null to defer resolution to the next provider in the chain.
Methods
GetPath(string)
Attempts to resolve a RootedPath for the given key.
public RootedPath? GetPath(string key)
Parameters
keystringThe key identifying the path to locate (e.g.
"Root","Artifacts").
Returns
- RootedPath
A RootedPath if this provider recognises
key; otherwisenullto pass resolution to the next provider in the chain.