Skip to content

Commit

Permalink
Merge pull request #1383 from cnurse/dev
Browse files Browse the repository at this point in the history
Convert Database projects so they build installable Packages
  • Loading branch information
sbwalker authored May 20, 2021
2 parents 4474d49 + 47c04dc commit 6f123c0
Show file tree
Hide file tree
Showing 81 changed files with 434 additions and 143 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ msbuild.binlog
.vscode/
*.binlog
*.nupkg
*.nupkg.bak

*.idea

Expand All @@ -17,3 +18,6 @@ Oqtane.Server/Data/*.db

/Oqtane.Server/Properties/PublishProfiles/FolderProfile.pubxml
Oqtane.Server/Content
Oqtane.Server/wwwroot/Packages/**/assets.json


1 change: 1 addition & 0 deletions Oqtane.Client/Installer/Installer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
var config = new InstallConfig
{
DatabaseType = database.DBType,
DatabasePackage = database.Package,
ConnectionString = connectionString,
Aliases = uri.Authority,
HostEmail = _hostEmail,
Expand Down
1 change: 1 addition & 0 deletions Oqtane.Client/Modules/Admin/Sites/Add.razor
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ else
{
config.TenantName = _tenantName;
config.DatabaseType = database.DBType;
config.DatabasePackage = database.Package;
config.ConnectionString = connectionString;
config.HostEmail = user.Email;
config.HostPassword = _hostpassword;
Expand Down
9 changes: 2 additions & 7 deletions Oqtane.Database.MySQL/MySQLDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
using MySql.Data.MySqlClient;
using MySql.EntityFrameworkCore.Metadata;
using Oqtane.Databases;
using Oqtane.Shared;

namespace Oqtane.Database.MySQL
Expand All @@ -14,21 +15,15 @@ public class MySQLDatabase : OqtaneDatabaseBase

private static string _name => "MySQL";

private readonly static string _typeName;

static MySQLDatabase()
{
var typeQualifiedName = typeof(MySQLDatabase).AssemblyQualifiedName;

_typeName = typeQualifiedName.Substring(0, typeQualifiedName.IndexOf(", Version"));
Initialize(typeof(MySQLDatabase));
}

public MySQLDatabase() :base(_name, _friendlyName) { }

public override string Provider => "MySql.EntityFrameworkCore";

public override string TypeName => _typeName;

public override OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name)
{
return table.Column<int>(name: name, nullable: false).Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn);
Expand Down
36 changes: 26 additions & 10 deletions Oqtane.Database.MySQL/Oqtane.Database.MySQL.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>9</LangVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0</Version>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
<PackageName>$(MSBuildProjectName).$(Version).nupkg</PackageName>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MySql.EntityFrameworkCore" Version="5.0.0" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MySql.EntityFrameworkCore" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Server\Oqtane.Server.csproj" />
</ItemGroup>

<Target Name="CopyPackage" AfterTargets="Pack">
<Copy SourceFiles="$(OutputPath)..\$(PackageName)" DestinationFiles="..\Oqtane.Server\wwwroot\Packages\$(PackageName).bak" />
</Target>
</Project>
25 changes: 25 additions & 0 deletions Oqtane.Database.MySQL/Oqtane.Database.MySQL.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Oqtane.Database.MySQL</id>
<version>1.0.0</version>
<authors>Shaun Walker</authors>
<owners>.NET Foundation</owners>
<title>Oqtane MySQL Provider</title>
<description>Add support for MySQL to the Oqtane Framework</description>
<copyright>.NET Foundation</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
<tags>oqtane</tags>
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v2.0.2</releaseNotes>
<summary>Add support for MySQL to the Oqtane Framework</summary>
</metadata>
<files>
<file src="bin\net5.0\Oqtane.Database.MySQL.dll" target="lib\net5.0" />
<file src="bin\net5.0\Oqtane.Database.MySQL.pdb" target="lib\net5.0" />
<file src="bin\net5.0\Mysql.EntityFrameworkCore.dll" target="lib\net5.0" />
<file src="bin\net5.0\Mysql.Data.dll" target="lib\net5.0" />
</files>
</package>
40 changes: 28 additions & 12 deletions Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>9</LangVersion>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0</Version>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
<PackageName>$(MSBuildProjectName).$(Version).nupkg</PackageName>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EFCore.NamingConventions" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EFCore.NamingConventions" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Server\Oqtane.Server.csproj" />
</ItemGroup>

<Target Name="CopyPackage" AfterTargets="Pack">
<Copy SourceFiles="$(OutputPath)..\$(PackageName)" DestinationFiles="..\Oqtane.Server\wwwroot\Packages\$(PackageName).bak" />
</Target>
</Project>
26 changes: 26 additions & 0 deletions Oqtane.Database.PostgreSQL/Oqtane.Database.PostgreSQL.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Oqtane.Database.PostgreSQL</id>
<version>1.0.0</version>
<authors>Shaun Walker</authors>
<owners>.NET Foundation</owners>
<title>Oqtane PostgreSQL Provider</title>
<description>Add support for PostgreSQL to the Oqtane Framework</description>
<copyright>.NET Foundation</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
<tags>oqtane</tags>
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v2.0.2</releaseNotes>
<summary>Add support for PostgreSQL to the Oqtane Framework</summary>
</metadata>
<files>
<file src="bin\net5.0\Oqtane.Database.PostgreSQL.dll" target="lib\net5.0" />
<file src="bin\net5.0\Oqtane.Database.PostgreSQL.pdb" target="lib\net5.0" />
<file src="bin\net5.0\EFCore.NamingConventions.dll" target="lib\net5.0" />
<file src="bin\net5.0\Npgsql.EntityFrameworkCore.PostgreSQL.dll" target="lib\net5.0" />
<file src="bin\net5.0\Npgsql.dll" target="lib\net5.0" />
</files>
</package>
9 changes: 2 additions & 7 deletions Oqtane.Database.PostgreSQL/PostgreSQLDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
using Npgsql;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Oqtane.Databases;
using Oqtane.Shared;

namespace Oqtane.Database.PostgreSQL
Expand All @@ -17,15 +18,11 @@ public class PostgreSQLDatabase : OqtaneDatabaseBase

private static string _name => "PostgreSQL";

private readonly static string _typeName;

private readonly INameRewriter _rewriter;

static PostgreSQLDatabase()
{
var typeQualifiedName = typeof(PostgreSQLDatabase).AssemblyQualifiedName;

_typeName = typeQualifiedName.Substring(0, typeQualifiedName.IndexOf(", Version"));
Initialize(typeof(PostgreSQLDatabase));
}

public PostgreSQLDatabase() : base(_name, _friendlyName)
Expand All @@ -35,8 +32,6 @@ public PostgreSQLDatabase() : base(_name, _friendlyName)

public override string Provider => "Npgsql.EntityFrameworkCore.PostgreSQL";

public override string TypeName => _typeName;

public override OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name)
{
return table.Column<int>(name: name, nullable: false).Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
Expand Down
8 changes: 1 addition & 7 deletions Oqtane.Database.SqlServer/LocalDbDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ public class LocalDbDatabase : SqlServerDatabaseBase
private static string _friendlyName => "Local Database";
private static string _name => "LocalDB";

private readonly static string _typeName;

static LocalDbDatabase()
{
var typeQualifiedName = typeof(LocalDbDatabase).AssemblyQualifiedName;

_typeName = typeQualifiedName.Substring(0, typeQualifiedName.IndexOf(", Version"));
Initialize(typeof(LocalDbDatabase));
}

public LocalDbDatabase() :base(_name, _friendlyName) { }

public override string TypeName => _typeName;
}
}
36 changes: 27 additions & 9 deletions Oqtane.Database.SqlServer/Oqtane.Database.SqlServer.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0</Version>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
<PackageName>$(MSBuildProjectName).$(Version).nupkg</PackageName>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.4" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Server\Oqtane.Server.csproj" />
</ItemGroup>

<Target Name="CopyPackage" AfterTargets="Pack">
<Copy SourceFiles="$(OutputPath)..\$(PackageName)" DestinationFiles="..\Oqtane.Server\wwwroot\Packages\$(PackageName).bak" />
</Target>

</Project>
24 changes: 24 additions & 0 deletions Oqtane.Database.SqlServer/Oqtane.Database.SqlServer.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Oqtane.Database.SqlServer</id>
<version>1.0.0</version>
<authors>Shaun Walker</authors>
<owners>.NET Foundation</owners>
<title>Oqtane SqlServer Provider</title>
<description>Add support for SqlServer to the Oqtane Framework</description>
<copyright>.NET Foundation</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
<tags>oqtane</tags>
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v2.0.2</releaseNotes>
<summary>Add support for SqlServer to the Oqtane Framework</summary>
</metadata>
<files>
<file src="bin\net5.0\Oqtane.Database.SqlServer.dll" target="lib\net5.0" />
<file src="bin\net5.0\Oqtane.Database.SqlServer.pdb" target="lib\net5.0" />
<file src="bin\net5.0\Microsoft.EntityFrameworkCore.SqlServer.dll" target="lib\net5.0" />
</files>
</package>
8 changes: 1 addition & 7 deletions Oqtane.Database.SqlServer/SqlServerDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ public class SqlServerDatabase : SqlServerDatabaseBase

private static string _name => "SqlServer";

private readonly static string _typeName;

static SqlServerDatabase()
{
var typeQualifiedName = typeof(SqlServerDatabase).AssemblyQualifiedName;

_typeName = typeQualifiedName.Substring(0, typeQualifiedName.IndexOf(", Version"));
Initialize(typeof(SqlServerDatabase));
}

public SqlServerDatabase() : base(_name, _friendlyName) { }

public override string TypeName => _typeName;
}
}
1 change: 1 addition & 0 deletions Oqtane.Database.SqlServer/SqlServerDatabaseBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
using Oqtane.Databases;
using Oqtane.Shared;

namespace Oqtane.Database.SqlServer
Expand Down
36 changes: 27 additions & 9 deletions Oqtane.Database.Sqlite/Oqtane.Database.Sqlite.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0</Version>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
<PackageName>$(MSBuildProjectName).$(Version).nupkg</PackageName>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.4" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Oqtane.Server\Oqtane.Server.csproj" />
</ItemGroup>

<Target Name="CopyPackage" AfterTargets="Pack">
<Copy SourceFiles="$(OutputPath)..\$(PackageName)" DestinationFiles="..\Oqtane.Server\wwwroot\Packages\$(PackageName).bak" />
</Target>

</Project>
Loading

0 comments on commit 6f123c0

Please sign in to comment.