Empeld
Empeld plugin documentation.
pluginbase.Dependencies.PluginDependencies Class Reference

Manages dependencies for a plugin More...

Public Member Functions

void AddDependency< T > (T depn, bool depnOverride, bool force)
 Add a dependency to be used within a plugin context More...
 
void AddDependency< T > (T depn, bool depnOverride)
 Add a dependency to be used within a plugin context More...
 
void AddDependency< T > (T depn)
 Add a dependency to be used within a plugin context More...
 
object GetDependency (Assembly asker, Type type)
 Get a dependency of a type on behalf of a specific assembly More...
 
GetDependency< T > (Assembly asker)
 Gets the dependency or returns null More...
 

Detailed Description

Manages dependencies for a plugin

Member Function Documentation

◆ AddDependency< T >() [1/3]

void pluginbase.Dependencies.PluginDependencies.AddDependency< T > ( depn,
bool  depnOverride,
bool  force 
)

Add a dependency to be used within a plugin context

Parameters
depnThe dependency
depnOverrideIf true, will override any existing dependencies of the same types
forceIf set to true, will add dependency even if not marked as an injectable
Template Parameters
TThe type in which to inject on
Type Constraints
T :class 
36  : class
37  {
38  AddDependency(typeof(T), depn, depnOverride, force);
39  }

◆ AddDependency< T >() [2/3]

void pluginbase.Dependencies.PluginDependencies.AddDependency< T > ( depn,
bool  depnOverride 
)

Add a dependency to be used within a plugin context

Parameters
depnThe dependency
depnOverrideIf true, will override any existing dependencies of the same types
Template Parameters
TThe type in which to inject on
Type Constraints
T :class 
48  : class
49  {
50  AddDependency(depn, depnOverride, false);
51  }

◆ AddDependency< T >() [3/3]

void pluginbase.Dependencies.PluginDependencies.AddDependency< T > ( depn)

Add a dependency to be used within a plugin context

Parameters
depnThe dependency
Template Parameters
TThe type in which to inject on
Type Constraints
T :class 
59  : class
60  {
61  AddDependency(depn, false, false);
62  }

◆ GetDependency()

object pluginbase.Dependencies.PluginDependencies.GetDependency ( Assembly  asker,
Type  type 
)

Get a dependency of a type on behalf of a specific assembly

Returns
The dependency.
Parameters
askerAsker.
typeType.
134  {
135  DependencyCollection asmDeps;
136  object dep;
137  if (_assemblyDependencies.TryGetValue(asker, out asmDeps)
138  && asmDeps.TryGetDependency(type, out dep))
139  {
140  return dep;
141  }
142  return GetDependency(type);
143  }

◆ GetDependency< T >()

T pluginbase.Dependencies.PluginDependencies.GetDependency< T > ( Assembly  asker)

Gets the dependency or returns null

Returns
The dependency.
Template Parameters
TThe 1st type parameter.
Type Constraints
T :class 
155  : class
156  {
157  return (T)GetDependency(asker, typeof(T));
158  }

The documentation for this class was generated from the following file: