-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
165 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.15.0 | ||
5.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using Stashbox.Utils; | ||
|
||
namespace Stashbox; | ||
|
||
/// <summary> | ||
/// Represents a specialized resolution override. | ||
/// </summary> | ||
public class Override | ||
{ | ||
private Override(object instance, object? dependencyName, Type type) | ||
{ | ||
this.Instance = instance; | ||
this.DependencyName = dependencyName; | ||
this.Type = type; | ||
} | ||
|
||
/// <summary> | ||
/// The name of the override used for named resolution. | ||
/// </summary> | ||
public object? DependencyName { get; } | ||
|
||
/// <summary> | ||
/// The instance used as dependency override. | ||
/// </summary> | ||
public object Instance { get; } | ||
|
||
/// <summary> | ||
/// The type of the dependency override. | ||
/// </summary> | ||
public Type Type { get; } | ||
|
||
/// <summary> | ||
/// Creates a new <see cref="Override"/> instance. | ||
/// </summary> | ||
/// <param name="instance">The instance used as dependency override.</param> | ||
/// <param name="name">The optional name of the instance used as dependency override.</param> | ||
/// <returns>The constructed override instance.</returns> | ||
public static Override Of<TType>(TType instance, object? name = null) where TType: notnull => new(instance, name, TypeCache<TType>.Type); | ||
|
||
/// <summary> | ||
/// Creates a new <see cref="Override"/> instance. | ||
/// </summary> | ||
/// <param name="type">The type of the override.</param> | ||
/// <param name="instance">The instance used as dependency override.</param> | ||
/// <param name="name">The optional name of the instance used as dependency override.</param> | ||
/// <returns>The constructed override instance.</returns> | ||
public static Override Of(Type type, object instance, object? name = null) => new(instance, name, type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.