-
Notifications
You must be signed in to change notification settings - Fork 22
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
1 parent
8c083f9
commit a8d5f92
Showing
11 changed files
with
39 additions
and
44 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/ConsoleAdapter.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
using System; | ||
|
||
namespace _PureDIProjectName_; | ||
|
||
public class ConsoleAdapter: IInput, IOutput | ||
{ | ||
public string? ReadLine() => Console.ReadLine(); | ||
public ValueTask<string?> ReadLineAsync(CancellationToken cancellationToken = default) => | ||
Console.In.ReadLineAsync(cancellationToken); | ||
|
||
public void WriteLine(string? line) => Console.WriteLine(line); | ||
public Task WriteLineAsync(string line = "", CancellationToken cancellationToken = default) => | ||
Console.Out.WriteLineAsync(line.AsMemory(), cancellationToken); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/GlobalUsings.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,6 @@ | ||
global using System; | ||
global using System.Diagnostics; | ||
global using System.Threading; | ||
global using System.Threading.Tasks; | ||
global using Pure.DI; | ||
global using static Pure.DI.Lifetime; |
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
11 changes: 2 additions & 9 deletions
11
src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/_CompositionName_.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 |
---|---|---|
@@ -1,16 +1,9 @@ | ||
using System.Diagnostics; | ||
using Pure.DI; | ||
using static Pure.DI.Lifetime; | ||
namespace _PureDIProjectName_; | ||
|
||
namespace _PureDIProjectName_; | ||
|
||
/// <summary> | ||
/// Pure.DI Composition Setup. Please see <see href="https://github.com/DevTeam/Pure.DI.Solution">this</see> example. | ||
/// </summary> | ||
internal class $(CompositionName) | ||
{ | ||
[Conditional("DI")] | ||
void Setup() => | ||
private void Setup() => | ||
DI.Setup(nameof($(CompositionName)), CompositionKind.Global) | ||
.Bind().As(Singleton).To<ConsoleAdapter>(); | ||
} |
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
6 changes: 5 additions & 1 deletion
6
src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/GlobalUsings.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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
global using _PureDIProjectName_; | ||
global using System; | ||
global using System.Diagnostics; | ||
global using System.Diagnostics; | ||
global using System.Threading; | ||
global using System.Threading.Tasks; | ||
global using Pure.DI; | ||
global using static Pure.DI.Lifetime; |
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
27 changes: 11 additions & 16 deletions
27
src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/Program.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
11 changes: 3 additions & 8 deletions
11
src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/_CompositionName_.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 |
---|---|---|
@@ -1,16 +1,11 @@ | ||
using Pure.DI; | ||
using static Pure.DI.Lifetime; | ||
namespace _PureDIProjectName_; | ||
|
||
namespace _PureDIProjectName_; | ||
|
||
/// <summary> | ||
/// Pure.DI Composition Setup. Please see <see href="https://github.com/DevTeam/Pure.DI.Solution">this</see> example. | ||
/// </summary> | ||
internal partial class $(CompositionName) | ||
{ | ||
[Conditional("DI")] | ||
void Setup() => | ||
private void Setup() => | ||
DI.Setup(nameof($(CompositionName))) | ||
.Arg<string[]>("args") | ||
.Bind().As(Singleton).To<ConsoleAdapter>() | ||
.Root<Program>("Root"); | ||
} |