Skip to content

Commit cbf04bc

Browse files
committed
Added the ability to register a new plugin by passing an instance of the plugin
1 parent 7664d35 commit cbf04bc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Source/Shared/Configuration/ExceptionlessConfiguration.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,16 @@ public IEnumerable<PluginRegistration> Plugins {
225225
get { return _plugins.Values.OrderBy(e => e.Priority).ToList(); }
226226
}
227227

228+
/// <summary>
229+
/// Register an plugin to be used in this configuration.
230+
/// </summary>
231+
/// <typeparam name="T">The plugin type to be added.</typeparam>
232+
/// <param name="plugin">The plugin instance to be added.</param>
233+
public void AddPlugin<T>(T plugin) where T : IEventPlugin {
234+
string key = typeof(T).FullName;
235+
_plugins[key] = new PluginRegistration(key, GetPriority(typeof(T)), new Lazy<IEventPlugin>(() => plugin));
236+
}
237+
228238
/// <summary>
229239
/// Register an plugin to be used in this configuration.
230240
/// </summary>

0 commit comments

Comments
 (0)