diff --git a/ProductionInCehOTP/ProductionInCehOTP.csproj b/ProductionInCehOTP/ProductionInCehOTP.csproj index accbdf0..5e3387e 100644 --- a/ProductionInCehOTP/ProductionInCehOTP.csproj +++ b/ProductionInCehOTP/ProductionInCehOTP.csproj @@ -9,7 +9,13 @@ + + + + + + diff --git a/ProductionInCehOTP/Program.cs b/ProductionInCehOTP/Program.cs index 680e145..dbcb3e4 100644 --- a/ProductionInCehOTP/Program.cs +++ b/ProductionInCehOTP/Program.cs @@ -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(); container.RegisterType(); container.RegisterType(); container.RegisterType(); container.RegisterType(); + container.RegisterType(); 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; + + //} } } \ No newline at end of file diff --git a/ProductionInCehOTP/Repositories/IConnectionString.cs b/ProductionInCehOTP/Repositories/IConnectionString.cs new file mode 100644 index 0000000..cf821b3 --- /dev/null +++ b/ProductionInCehOTP/Repositories/IConnectionString.cs @@ -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;} +} diff --git a/ProductionInCehOTP/Repositories/Implementations/ArrivalMaterialsRepository.cs b/ProductionInCehOTP/Repositories/Implementations/ArrivalMaterialsRepository.cs index de1872e..f28d943 100644 --- a/ProductionInCehOTP/Repositories/Implementations/ArrivalMaterialsRepository.cs +++ b/ProductionInCehOTP/Repositories/Implementations/ArrivalMaterialsRepository.cs @@ -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) { diff --git a/ProductionInCehOTP/Repositories/Implementations/ConnectionString.cs b/ProductionInCehOTP/Repositories/Implementations/ConnectionString.cs new file mode 100644 index 0000000..1c2ce75 --- /dev/null +++ b/ProductionInCehOTP/Repositories/Implementations/ConnectionString.cs @@ -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 => ""; + } +} diff --git a/ProductionInCehOTP/appsettings.json b/ProductionInCehOTP/appsettings.json new file mode 100644 index 0000000..1a808ee --- /dev/null +++ b/ProductionInCehOTP/appsettings.json @@ -0,0 +1,16 @@ +{ + "Serilog": { + "Using": [ "Serilog.Sinks.File" ], + "MinimumLevel": "Debug", + "WriteTo": [ + { + "Name": "File", + "Args": { + "path": "Logs/factory_log.txt", + "rollingInterval": "Day" + } + } + ] + } + +} \ No newline at end of file