diff --git a/src/Pure.DI.Templates/Pure.DI.Templates.csproj b/src/Pure.DI.Templates/Pure.DI.Templates.csproj index 24dd89ea5..176db540d 100644 --- a/src/Pure.DI.Templates/Pure.DI.Templates.csproj +++ b/src/Pure.DI.Templates/Pure.DI.Templates.csproj @@ -19,6 +19,7 @@ + content diff --git a/src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/GlobalUsings.cs b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/GlobalUsings.cs new file mode 100644 index 000000000..804ba47b8 --- /dev/null +++ b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/GlobalUsings.cs @@ -0,0 +1,4 @@ +global using System; +global using System.Diagnostics; +global using Pure.DI; +global using static Pure.DI.Lifetime; \ No newline at end of file diff --git a/src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/_CompositionName_.cs b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/_CompositionName_.cs index 3a9a16516..253f05997 100644 --- a/src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/_CompositionName_.cs +++ b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ClassLibrary/_CompositionName_.cs @@ -1,16 +1,9 @@ -using System.Diagnostics; -using Pure.DI; -using static Pure.DI.Lifetime; +namespace _PureDIProjectName_; -namespace _PureDIProjectName_; - -/// -/// Pure.DI Composition Setup. Please see this example. -/// internal class $(CompositionName) { [Conditional("DI")] - void Setup() => + private void Setup() => DI.Setup(nameof($(CompositionName)), CompositionKind.Global) .Bind().As(Singleton).To(); } \ No newline at end of file diff --git a/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/GlobalUsings.cs b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/GlobalUsings.cs index 7ac23b498..3653e2e6e 100644 --- a/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/GlobalUsings.cs +++ b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/GlobalUsings.cs @@ -1,3 +1,5 @@ global using _PureDIProjectName_; global using System; -global using System.Diagnostics; \ No newline at end of file +global using System.Diagnostics; +global using Pure.DI; +global using static Pure.DI.Lifetime; \ No newline at end of file diff --git a/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/_CompositionName_.cs b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/_CompositionName_.cs index 3bcb4cd38..ee671357c 100644 --- a/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/_CompositionName_.cs +++ b/src/Pure.DI.Templates/Templates/Pure.DI.Template.ConsoleApp/_CompositionName_.cs @@ -1,16 +1,11 @@ -using Pure.DI; -using static Pure.DI.Lifetime; +namespace _PureDIProjectName_; -namespace _PureDIProjectName_; - -/// -/// Pure.DI Composition Setup. Please see this example. -/// internal partial class $(CompositionName) { [Conditional("DI")] - void Setup() => + private void Setup() => DI.Setup(nameof($(CompositionName))) + .Arg("args") .Bind().As(Singleton).To() .Root("Root"); } \ No newline at end of file