-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Tim-Maes/feature/try-add-implementation
Add support for TryAddScoped, TryAddTransient and TryAddSingleton
- Loading branch information
Showing
7 changed files
with
78 additions
and
15 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
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 |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
public enum Lifetime | ||
{ | ||
Scoped, | ||
TryAddScoped, | ||
Transient, | ||
TryAddTransient, | ||
Singleton, | ||
Transient | ||
TryAddSingleton | ||
} |
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,10 @@ | ||
namespace Bindicate.Attributes; | ||
|
||
public class TryAddScopedAttribute : BaseServiceAttribute | ||
{ | ||
public override Lifetime Lifetime => Lifetime.TryAddScoped; | ||
|
||
public TryAddScopedAttribute() : base() { } | ||
|
||
public TryAddScopedAttribute(Type serviceType) : base(serviceType) { } | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Bindicate/Attributes/Singleton/TryAddSingletonAttribute.cs
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,10 @@ | ||
namespace Bindicate.Attributes; | ||
|
||
public class TryAddSingletonAttribute : BaseServiceAttribute | ||
{ | ||
public override Lifetime Lifetime => Lifetime.TryAddSingleton; | ||
|
||
public TryAddSingletonAttribute() : base() { } | ||
|
||
public TryAddSingletonAttribute(Type serviceType) : base(serviceType) { } | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Bindicate/Attributes/Transient/TryAddTransientAttribute.cs
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,10 @@ | ||
namespace Bindicate.Attributes; | ||
|
||
public class TryAddTransientAttribute : BaseServiceAttribute | ||
{ | ||
public override Lifetime Lifetime => Lifetime.TryAddTransient; | ||
|
||
public TryAddTransientAttribute() : base() { } | ||
|
||
public TryAddTransientAttribute(Type serviceType) : base(serviceType) { } | ||
} |
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