Convert Database projects so they build installable Packages rather than deploy to bin and modify installation to deploy Databases on demand as needed.

This commit is contained in:
Charles Nurse
2021-05-20 12:39:09 -07:00
parent 4474d49c6a
commit 47c04dc150
81 changed files with 434 additions and 143 deletions

View File

@ -5,17 +5,11 @@ namespace Oqtane.Database.SqlServer
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;
}
}

View File

@ -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>

View File

@ -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>

View File

@ -6,17 +6,11 @@ namespace Oqtane.Database.SqlServer
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;
}
}

View File

@ -4,6 +4,7 @@ using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
using Oqtane.Databases;
using Oqtane.Shared;
namespace Oqtane.Database.SqlServer