Skip to content

Commit

Permalink
Updating to .net core 2.1. Documentation update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgios (Yiorgos) Trifidis committed Jan 7, 2019
1 parent 31fc50c commit 3991413
Show file tree
Hide file tree
Showing 150 changed files with 3,548 additions and 2,380 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ OrpheusTests/OrpheusSQLiteServerConfig.json
/.vs/Orpheus.NetCore/v15/Server/sqlite3/storage.ide-shm
/.vs/Orpheus.NetCore/v15/Server/sqlite3/db.lock
/.vs/Orpheus.NetCore/DesignTimeBuild/.dtbcache
/Nuget/2.0.0/lib/netstandard2.1
26 changes: 13 additions & 13 deletions Nuget/CreatePackage.cmd
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
@echo building solution
"%programfiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" ..\Orpheus.NetCore.sln /t:Clean,Build /p:Configuration=Release

mkdir 2.0.0\lib\netstandard2.0
mkdir 2.0.0\lib\netstandard2.1
@echo Nuget folder created.
xcopy ..\OrpheusAttributes\bin\release\netcoreapp2.0\OrpheusAttributes.dll 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusAttributes\bin\release\netcoreapp2.0\OrpheusAttributes.xml 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusAttributes\bin\release\netcoreapp2.1\OrpheusAttributes.dll 2.0.0\lib\netstandard2.1 /Y /Q
xcopy ..\OrpheusAttributes\bin\release\netcoreapp2.1\OrpheusAttributes.xml 2.0.0\lib\netstandard2.1 /Y /Q

xcopy ..\OrpheusCore\bin\release\netcoreapp2.0\OrpheusCore.dll 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusCore\bin\release\netcoreapp2.0\OrpheusCore.xml 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusCore\bin\release\netcoreapp2.1\OrpheusCore.dll 2.0.0\lib\netstandard2.1 /Y /Q
xcopy ..\OrpheusCore\bin\release\netcoreapp2.1\OrpheusCore.xml 2.0.0\lib\netstandard2.1 /Y /Q

xcopy ..\OrpheusInterfaces\bin\release\netcoreapp2.0\OrpheusInterfaces.dll 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusInterfaces\bin\release\netcoreapp2.0\OrpheusInterfaces.xml 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusInterfaces\bin\release\netcoreapp2.1\OrpheusInterfaces.dll 2.0.0\lib\netstandard2.1 /Y /Q
xcopy ..\OrpheusInterfaces\bin\release\netcoreapp2.1\OrpheusInterfaces.xml 2.0.0\lib\netstandard2.1 /Y /Q

xcopy ..\OrpheusLogger\bin\release\netcoreapp2.0\OrpheusLogger.dll 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusLogger\bin\release\netcoreapp2.0\OrpheusLogger.xml 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusLogger\bin\release\netcoreapp2.1\OrpheusLogger.dll 2.0.0\lib\netstandard2.1 /Y /Q
xcopy ..\OrpheusLogger\bin\release\netcoreapp2.1\OrpheusLogger.xml 2.0.0\lib\netstandard2.1 /Y /Q

xcopy ..\OrpheusMySQLDDLHelper\bin\release\netcoreapp2.0\OrpheusMySQLDDLHelper.dll 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusMySQLDDLHelper\bin\release\netcoreapp2.0\OrpheusMySQLDDLHelper.xml 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusMySQLDDLHelper\bin\release\netcoreapp2.1\OrpheusMySQLDDLHelper.dll 2.0.0\lib\netstandard2.1 /Y /Q
xcopy ..\OrpheusMySQLDDLHelper\bin\release\netcoreapp2.1\OrpheusMySQLDDLHelper.xml 2.0.0\lib\netstandard2.1 /Y /Q

xcopy ..\OrpheusSQLServerDDLHelper\bin\release\netcoreapp2.0\OrpheusSQLServerDDLHelper.dll 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusSQLServerDDLHelper\bin\release\netcoreapp2.0\OrpheusSQLServerDDLHelper.xml 2.0.0\lib\netstandard2.0 /Y /Q
xcopy ..\OrpheusSQLServerDDLHelper\bin\release\netcoreapp2.1\OrpheusSQLServerDDLHelper.dll 2.0.0\lib\netstandard2.1 /Y /Q
xcopy ..\OrpheusSQLServerDDLHelper\bin\release\netcoreapp2.1\OrpheusSQLServerDDLHelper.xml 2.0.0\lib\netstandard2.1 /Y /Q

@echo assemblies copied.
del *.nupkg /F
Expand Down
18 changes: 9 additions & 9 deletions Nuget/OrpheusORM.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>OrpheusORM</id>
<version>1.1.4</version>
<version>1.1.5</version>
<title>OrpheusORM</title>
<authors>Trifidis Georgios(Yiorgos)</authors>
<owners>Trifidis Georgios(Yiorgos)</owners>
Expand All @@ -20,16 +20,16 @@
</dependencies>
</metadata>
<files>
<file src="2.0.0\lib\netstandard2.0\OrpheusCore.dll" target="lib\netstandard2.0\OrpheusCore.dll" />
<file src="2.0.0\lib\netstandard2.0\OrpheusCore.xml" target="lib\netstandard2.0\OrpheusCore.xml" />
<file src="2.0.0\lib\netstandard2.1\OrpheusCore.dll" target="lib\netstandard2.1\OrpheusCore.dll" />
<file src="2.0.0\lib\netstandard2.1\OrpheusCore.xml" target="lib\netstandard2.0\OrpheusCore.xml" />

<file src="2.0.0\lib\netstandard2.0\OrpheusInterfaces.dll" target="lib\netstandard2.0\OrpheusInterfaces.dll" />
<file src="2.0.0\lib\netstandard2.0\OrpheusInterfaces.xml" target="lib\netstandard2.0\OrpheusInterfaces.xml" />
<file src="2.0.0\lib\netstandard2.1\OrpheusInterfaces.dll" target="lib\netstandard2.1\OrpheusInterfaces.dll" />
<file src="2.0.0\lib\netstandard2.1\OrpheusInterfaces.xml" target="lib\netstandard2.1\OrpheusInterfaces.xml" />

<file src="2.0.0\lib\netstandard2.0\OrpheusAttributes.dll" target="lib\netstandard2.0\OrpheusAttributes.dll" />
<file src="2.0.0\lib\netstandard2.0\OrpheusAttributes.xml" target="lib\netstandard2.0\OrpheusAttributes.xml" />
<file src="2.0.0\lib\netstandard2.1\OrpheusAttributes.dll" target="lib\netstandard2.1\OrpheusAttributes.dll" />
<file src="2.0.0\lib\netstandard2.1\OrpheusAttributes.xml" target="lib\netstandard2.1\OrpheusAttributes.xml" />

<file src="2.0.0\lib\netstandard2.0\OrpheusLogger.dll" target="lib\netstandard2.0\OrpheusLogger.dll" />
<file src="2.0.0\lib\netstandard2.0\OrpheusLogger.xml" target="lib\netstandard2.0\OrpheusLogger.xml" />
<file src="2.0.0\lib\netstandard2.1\OrpheusLogger.dll" target="lib\netstandard2.1\OrpheusLogger.dll" />
<file src="2.0.0\lib\netstandard2.1\OrpheusLogger.xml" target="lib\netstandard2.1\OrpheusLogger.xml" />
</files>
</package>
8 changes: 4 additions & 4 deletions Nuget/OrpheusORMMySQLServerHelper.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>OrpheusORMMySQLServerDDLHelper</id>
<version>1.1.4</version>
<version>1.1.5</version>
<title>OrpheusORM MySQL Server DDL Helper</title>
<authors>Trifidis Georgios(Yiorgos)</authors>
<owners>Trifidis Georgios(Yiorgos)</owners>
Expand All @@ -14,11 +14,11 @@
<projectUrl>https://github.com/gtrifidis/OrpheusORM</projectUrl>
<dependencies>
<dependency id="MySql.Data" version="8.0.12" />
<dependency id="OrpheusORM" version="1.1.4" />
<dependency id="OrpheusORM" version="1.1.5" />
</dependencies>
</metadata>
<files>
<file src="2.0.0\lib\netstandard2.0\OrpheusMySQLDDLHelper.dll" target="lib\netstandard2.0\OrpheusMySQLDDLHelper.dll" />
<file src="2.0.0\lib\netstandard2.0\OrpheusMySQLDDLHelper.xml" target="lib\netstandard2.0\OrpheusMySQLDDLHelper.xml" />
<file src="2.0.0\lib\netstandard2.1\OrpheusMySQLDDLHelper.dll" target="lib\netstandard2.1\OrpheusMySQLDDLHelper.dll" />
<file src="2.0.0\lib\netstandard2.1\OrpheusMySQLDDLHelper.xml" target="lib\netstandard2.1\OrpheusMySQLDDLHelper.xml" />
</files>
</package>
8 changes: 4 additions & 4 deletions Nuget/OrpheusORMSQLServerHelper.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>OrpheusORMSQLServerDDLHelper</id>
<version>1.1.4</version>
<version>1.1.5</version>
<title>OrpheusORM SQL Server DDL Helper</title>
<authors>Trifidis Georgios(Yiorgos)</authors>
<owners>Trifidis Georgios(Yiorgos)</owners>
Expand All @@ -14,11 +14,11 @@
<projectUrl>https://github.com/gtrifidis/OrpheusORM</projectUrl>
<dependencies>
<dependency id="System.Data.SqlClient" version="4.5.1" />
<dependency id="OrpheusORM" version="1.1.4" />
<dependency id="OrpheusORM" version="1.1.5" />
</dependencies>
</metadata>
<files>
<file src="2.0.0\lib\netstandard2.0\OrpheusSQLServerDDLHelper.dll" target="lib\netstandard2.0\OrpheusSQLServerDDLHelper.dll" />
<file src="2.0.0\lib\netstandard2.0\OrpheusSQLServerDDLHelper.xml" target="lib\netstandard2.0\OrpheusSQLServerDDLHelper.xml" />
<file src="2.0.0\lib\netstandard2.1\OrpheusSQLServerDDLHelper.dll" target="lib\netstandard2.1\OrpheusSQLServerDDLHelper.dll" />
<file src="2.0.0\lib\netstandard2.1\OrpheusSQLServerDDLHelper.xml" target="lib\netstandard2.1\OrpheusSQLServerDDLHelper.xml" />
</files>
</package>
9 changes: 4 additions & 5 deletions OrpheusAttributes/OrpheusAttributes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Version>1.0.0</Version>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Version>1.1.0</Version>
<Copyright>Trifidis Georgios (Yiorgos)</Copyright>
<AssemblyVersion>1.0.0.7</AssemblyVersion>
<FileVersion>1.0.0.7</FileVersion>
<PackageId>Orpheus ORM Attributes</PackageId>
<AssemblyVersion>1.1.5</AssemblyVersion>
<FileVersion>1.1.5</FileVersion>
<Product>Orpheus ORM</Product>
</PropertyGroup>

Expand Down
24 changes: 21 additions & 3 deletions OrpheusCore/Configuration/OrpheusConfigurationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public ServiceProviderItem()
/// <summary>
/// Orpheus logging configuration.
/// </summary>
public class LoggingConfiguration : ILoggingConfiguration
public class LoggingConfiguration : IFileLoggingConfiguration
{
/// <value>
/// Logging level.
Expand All @@ -75,6 +75,22 @@ public class LoggingConfiguration : ILoggingConfiguration
/// </value>
public int MaxFileSize { get; set; }

/// <summary>
/// Gets or sets the name of the file. If not defined, a file name will be automatically assigned.
/// </summary>
/// <value>
/// The name of the file.
/// </value>
public string FileName { get; set; }

/// <summary>
/// Gets or sets the file extension. Default extension is .log
/// </summary>
/// <value>
/// The file extension.
/// </value>
public string FileExtension { get; set; }

/// <value>
/// Constructor
/// </value>
Expand Down Expand Up @@ -115,7 +131,7 @@ public class DatabaseConnectionConfiguration : IDatabaseConnectionConfiguration
public string Password { get; set; }

/// <value>
/// SQL Server specific.
/// SQL Server specific. If true, any UserName/Password configured will be ignored.
/// </value>
public bool UseIntegratedSecurity { get; set; }

Expand Down Expand Up @@ -151,7 +167,9 @@ public IDatabaseConnectionConfiguration Clone()
UserName = this.UserName,
Password = this.Password,
UseIntegratedSecurity = this.UseIntegratedSecurity,
UseIntegratedSecurityForServiceConnection = this.UseIntegratedSecurityForServiceConnection
UseIntegratedSecurityForServiceConnection = this.UseIntegratedSecurityForServiceConnection,
ServicePassword = this.ServicePassword,
ServiceUserName = this.ServiceUserName
};
}
}
Expand Down
11 changes: 9 additions & 2 deletions OrpheusCore/Core/OrpheusDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,15 @@ public void Connect(string connectionString = null)
{
if (this.ddlHelper.DB == null)
this.ddlHelper.DB = this;
this.ddlHelper.CreateDatabase();
try
{
this.ddlHelper.CreateDatabase();
}
catch(Exception e)
{
this.logger.LogError(e, "Error creating database");
throw e;
}
if (!String.IsNullOrEmpty(connectionString))
this.dbConnection.ConnectionString = connectionString;
else
Expand All @@ -420,7 +428,6 @@ public void Connect(string connectionString = null)
catch (Exception e)
{
this.logger.LogError(e.Message);
this.logger.LogError($"Connection string {this.dbConnection.ConnectionString}");
throw e;
}
}
Expand Down
8 changes: 4 additions & 4 deletions OrpheusCore/OrpheusCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Version>1.1.0</Version>
<Copyright>Trifidis Georgios (Yiorgos)</Copyright>
<AssemblyVersion>1.1.5</AssemblyVersion>
<FileVersion>1.1.5</FileVersion>
<Product>Orpheus ORM</Product>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.7</AssemblyVersion>
<FileVersion>1.0.0.7</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
3 changes: 3 additions & 0 deletions OrpheusCore/ServiceProvider/OrpheusServiceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ private static void initializeInternalOrpheusServices(IServiceCollection service
serviceCollection.Configure<List<ServiceProviderItem>>(ConfigurationManager.ConfigurationInstance.GetSection("Services"));
serviceCollection.Configure<List<DatabaseConnectionConfiguration>>(ConfigurationManager.ConfigurationInstance.GetSection("DatabaseConnections"));
serviceCollection.Configure<OrpheusConfiguration>(ConfigurationManager.ConfigurationInstance);

//add loggging services.
serviceCollection.AddLogging();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion OrpheusDocumentation/OrpheusDocumentation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Copyright>Trifidis Georgios (Yiorgos)</Copyright>
<Product>Orpheus ORM</Product>
<Version>1.0.0</Version>
Expand Down
2 changes: 1 addition & 1 deletion OrpheusDocumentation/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"_appTitle": "Orpheus",
"_appLogoPath":"images/OrpheusLogo.svg",
"_enableNewTab": true,
"_appFooter":"Orpheus - Trifidis Georgios(Yiorgos) © 2018",
"_appFooter":"Orpheus - Trifidis Georgios(Yiorgos) © 2017 - 2019",
"_enableSearch":true
},
"fileMetadata": {
Expand Down
103 changes: 103 additions & 0 deletions OrpheusDocumentation/documentation/orpheus_configuring_nlog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Configuring NLog
To configure NLog to work with Orpheus, you'll need to have a wrapper class.

Prerequisite is to add [NLog](https://github.com/NLog/NLog.Extensions.Logging) to your project.

```csharp
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;

namespace YourNameSpace
{
/// <summary>
/// NLog wrapper
/// </summary>
/// <seealso cref="Microsoft.Extensions.Logging.ILogger" />
public class CommonLogger : ILogger
{
private ILogger nlogLogger;

/// <summary>
/// Initializes a new instance of the <see cref="CommonLogger"/> class.
/// </summary>
public CommonLogger()
{
//your ServiceProvider instance.
var loggerFactory = ServiceProvider.GetRequiredService<ILoggerFactory>();
//load nlog configuration
NLog.Web.NLogBuilder.ConfigureNLog("logging.config");
this.nlogLogger = loggerFactory.CreateLogger("YourLoggerName");
}

/// <summary>
/// Begins a logical operation scope.
/// </summary>
/// <typeparam name="TState"></typeparam>
/// <param name="state">The identifier for the scope.</param>
/// <returns>
/// An IDisposable that ends the logical operation scope on dispose.
/// </returns>
/// <exception cref="NotImplementedException"></exception>
public IDisposable BeginScope<TState>(TState state)
{
return this.nlogLogger.BeginScope<TState>(state);
}

/// <summary>
/// Checks if the given <paramref name="logLevel" /> is enabled.
/// </summary>
/// <param name="logLevel">level to be checked.</param>
/// <returns>
/// <c>true</c> if enabled.
/// </returns>
/// <exception cref="NotImplementedException"></exception>
public bool IsEnabled(LogLevel logLevel)
{
return this.nlogLogger.IsEnabled(logLevel);
}

/// <summary>
/// Writes a log entry.
/// </summary>
/// <typeparam name="TState"></typeparam>
/// <param name="logLevel">Entry will be written on this level.</param>
/// <param name="eventId">Id of the event.</param>
/// <param name="state">The entry to be written. Can be also an object.</param>
/// <param name="exception">The exception related to this entry.</param>
/// <param name="formatter">Function to create a <c>string</c> message of the <paramref name="state" /> and <paramref name="exception" />.</param>
/// <exception cref="NotImplementedException"></exception>
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
this.nlogLogger.Log<TState>(logLevel, eventId, state, exception, formatter);
}
}
}
```
After that you'll have to register your wrapper into Orpheu's configuration.
```json
"Services": [
{
"Implementation": "System.Data.SqlClient.SqlConnection, System.Data.SqlClient, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"Service": "System.Data.IDbConnection, System.Data.Common, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"ServiceLifeTime": "Transient"
},
{
"Implementation": "OrpheusCore.OrpheusDatabase, OrpheusCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Service": "OrpheusInterfaces.Core.IOrpheusDatabase, OrpheusInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"ServiceLifeTime": "Transient"
},
{
"Implementation": "OrpheusSQLDDLHelper.OrpheusSQLServerDDLHelper, OrpheusSQLServerDDLHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Service": "OrpheusInterfaces.Core.IOrpheusDDLHelper, OrpheusInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"ServiceLifeTime": "Transient"
},
{
"Implementation": "YourAssembly.CommonLogger, YourAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Service": "Microsoft.Extensions.Logging.ILogger, Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"ServiceLifeTime": "Transient"
}
],
```

Other logging frameworks, might require a similar approach.
Loading

0 comments on commit 3991413

Please sign in to comment.