-
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.
Showing
11 changed files
with
44 additions
and
39 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 ValueTask<string?> ReadLineAsync(CancellationToken cancellationToken = default) => | ||
Console.In.ReadLineAsync(cancellationToken); | ||
public string? ReadLine() => Console.ReadLine(); | ||
|
||
public Task WriteLineAsync(string line = "", CancellationToken cancellationToken = default) => | ||
Console.Out.WriteLineAsync(line.AsMemory(), cancellationToken); | ||
public void WriteLine(string? line) => Console.WriteLine(line); | ||
} |
6 changes: 0 additions & 6 deletions
6
src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/GlobalUsings.cs
This file was deleted.
Oops, something went wrong.
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: 9 additions & 2 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,9 +1,16 @@ | ||
namespace _PureDIProjectName_; | ||
using System.Diagnostics; | ||
using Pure.DI; | ||
using static Pure.DI.Lifetime; | ||
|
||
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")] | ||
private void Setup() => | ||
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: 1 addition & 5 deletions
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,7 +1,3 @@ | ||
global using _PureDIProjectName_; | ||
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; | ||
global using System.Diagnostics; |
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: 16 additions & 11 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: 8 additions & 3 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,11 +1,16 @@ | ||
namespace _PureDIProjectName_; | ||
using Pure.DI; | ||
using static Pure.DI.Lifetime; | ||
|
||
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")] | ||
private void Setup() => | ||
void Setup() => | ||
DI.Setup(nameof($(CompositionName))) | ||
.Arg<string[]>("args") | ||
.Bind().As(Singleton).To<ConsoleAdapter>() | ||
.Root<Program>("Root"); | ||
} |