Small updates to fix warnings + default top level statements
This commit is contained in:
4
files/.editorconfig
Normal file
4
files/.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[*.cs]
|
||||||
|
|
||||||
|
# CS8714: The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'notnull' constraint.
|
||||||
|
dotnet_diagnostic.CS8714.severity = none
|
||||||
@@ -4,11 +4,11 @@ using Domain;
|
|||||||
|
|
||||||
namespace Wiring
|
namespace Wiring
|
||||||
{
|
{
|
||||||
public class Wiring : IAdapterResolver, IDisposable
|
public class DomainWiring : IAdapterResolver, IDisposable
|
||||||
{
|
{
|
||||||
private readonly IContainer _container;
|
private readonly IContainer _container;
|
||||||
|
|
||||||
public Wiring()
|
public DomainWiring()
|
||||||
{
|
{
|
||||||
_container = Wire();
|
_container = Wire();
|
||||||
DomainPorts.SetResolver(this);
|
DomainPorts.SetResolver(this);
|
||||||
@@ -44,16 +44,9 @@ namespace Wiring
|
|||||||
// builder.RegisterType<CacheService>().As<ICacheService>().SingleInstance();
|
// builder.RegisterType<CacheService>().As<ICacheService>().SingleInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Resolve<T>()
|
|
||||||
{
|
|
||||||
return _container.Resolve<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public T Resolve<T>() => _container.Resolve<T>();
|
||||||
{
|
|
||||||
if (_container != null) {
|
public void Dispose() => _container?.Dispose();
|
||||||
_container.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ dotnet add Wiring package Autofac
|
|||||||
#dotnet add WebApi reference Domain
|
#dotnet add WebApi reference Domain
|
||||||
#dotnet add WebApi reference Wiring
|
#dotnet add WebApi reference Wiring
|
||||||
# console project
|
# console project
|
||||||
dotnet new console -n ConsoleApp
|
dotnet new console -n ConsoleApp --use-program-main
|
||||||
dotnet sln add ConsoleApp
|
dotnet sln add ConsoleApp
|
||||||
dotnet add ConsoleApp reference Domain
|
dotnet add ConsoleApp reference Domain
|
||||||
dotnet add ConsoleApp reference Wiring
|
dotnet add ConsoleApp reference Wiring
|
||||||
@@ -54,7 +54,8 @@ Pop-Location
|
|||||||
Copy-Item -Path "files/AssemblyInfo.cs" -Destination "$TargetFolder/Domain"
|
Copy-Item -Path "files/AssemblyInfo.cs" -Destination "$TargetFolder/Domain"
|
||||||
Copy-Item -Path "files/DomainPorts.cs" -Destination "$TargetFolder/Domain"
|
Copy-Item -Path "files/DomainPorts.cs" -Destination "$TargetFolder/Domain"
|
||||||
Copy-Item -Path "files/IAdapterResolver.cs" -Destination "$TargetFolder/Domain"
|
Copy-Item -Path "files/IAdapterResolver.cs" -Destination "$TargetFolder/Domain"
|
||||||
Copy-Item -Path "files/Wiring.cs" -Destination "$TargetFolder/Wiring"
|
Copy-Item -Path "files/DomainWiring.cs" -Destination "$TargetFolder/Wiring"
|
||||||
|
Copy-Item -Path "files/.editorconfig" -Destination "$TargetFolder"
|
||||||
|
|
||||||
# remove unused files
|
# remove unused files
|
||||||
Remove-Item "$TargetFolder/Domain/Class1.cs" -ErrorAction Ignore
|
Remove-Item "$TargetFolder/Domain/Class1.cs" -ErrorAction Ignore
|
||||||
|
|||||||
Reference in New Issue
Block a user