pu pu pu....
This commit is contained in:
parent
b72eae4c7b
commit
c3f1ec8d35
@ -9,7 +9,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,6 +1,10 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProductionInCehOTP.Repositories;
|
||||
using ProductionInCehOTP.Repositories.Implementations;
|
||||
using Serilog;
|
||||
using System.Configuration;
|
||||
using Unity;
|
||||
using Unity.Microsoft.Logging;
|
||||
|
||||
namespace ProductionInCehOTP
|
||||
{
|
||||
@ -20,12 +24,27 @@ namespace ProductionInCehOTP
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
//container.AddExtension(new LoggingExtension(CreateLoggerFactory()));
|
||||
container.RegisterType<IArrivalMaterialsRepository, ArrivalMaterialsRepository>();
|
||||
container.RegisterType<IMaterialReposirory, MaterialRepository>();
|
||||
container.RegisterType<IProductRepository, ProductRepository>();
|
||||
container.RegisterType<IPlanWorkRepository, PlanWorkRepository>();
|
||||
container.RegisterType<IWorkerRepository, WorkerRepository>();
|
||||
container.RegisterType<IConnectionString, ConnectionString>();
|
||||
return container;
|
||||
}
|
||||
|
||||
//private static LoggerFactory CreateLoggerFactory()
|
||||
//{
|
||||
// var loggerFactory = new LoggerFactory();
|
||||
// loggerFactory.AddSerilog(new LoggerConfiguration())
|
||||
// .ReadForm.Configuration(new ConfigurationBuilder())
|
||||
// .SetBasePath(Directory.GetCurrentDirectory())
|
||||
// .AddJsonFile("appsettings.json")
|
||||
// .Build())
|
||||
// .CreateLogger());
|
||||
// return loggerFactory;
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
12
ProductionInCehOTP/Repositories/IConnectionString.cs
Normal file
12
ProductionInCehOTP/Repositories/IConnectionString.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories;
|
||||
|
||||
public interface IConnectionString
|
||||
{
|
||||
public string ConnectionString { get;}
|
||||
}
|
@ -5,6 +5,11 @@ namespace ProductionInCehOTP.Repositories.Implementations;
|
||||
|
||||
public class ArrivalMaterialsRepository : IArrivalMaterialsRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
public ArrivalMaterialsRepository(IConnectionString connectionString)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
}
|
||||
public void CreateArrivalMaterials(ArrivalMaterials material)
|
||||
{
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionInCehOTP.Repositories.Implementations
|
||||
{
|
||||
public class ConnectionString : IConnectionString
|
||||
{
|
||||
string IConnectionString.ConnectionString => "";
|
||||
}
|
||||
}
|
16
ProductionInCehOTP/appsettings.json
Normal file
16
ProductionInCehOTP/appsettings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"Using": [ "Serilog.Sinks.File" ],
|
||||
"MinimumLevel": "Debug",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/factory_log.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user