Skip to content

Commit 293e0a5

Browse files
authored
Added PostgreSQL support. (#117)
1 parent 481d497 commit 293e0a5

File tree

40 files changed

+2635
-7965
lines changed

40 files changed

+2635
-7965
lines changed

backend/Cms.sln

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logitar.Cms.IntegrationTest
3030
EndProject
3131
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logitar.Cms.Tests", "tests\Logitar.Cms.Tests\Logitar.Cms.Tests.csproj", "{D8D16EBE-92E5-4813-8A1C-5F373916A63A}"
3232
EndProject
33+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logitar.Cms.Infrastructure.PostgreSQL", "src\Logitar.Cms.Infrastructure.PostgreSQL\Logitar.Cms.Infrastructure.PostgreSQL.csproj", "{8861C11E-E952-40B9-AC5C-4E70AA1C235C}"
34+
EndProject
3335
Global
3436
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3537
Debug|Any CPU = Debug|Any CPU
@@ -68,6 +70,10 @@ Global
6870
{D8D16EBE-92E5-4813-8A1C-5F373916A63A}.Debug|Any CPU.Build.0 = Debug|Any CPU
6971
{D8D16EBE-92E5-4813-8A1C-5F373916A63A}.Release|Any CPU.ActiveCfg = Release|Any CPU
7072
{D8D16EBE-92E5-4813-8A1C-5F373916A63A}.Release|Any CPU.Build.0 = Release|Any CPU
73+
{8861C11E-E952-40B9-AC5C-4E70AA1C235C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
74+
{8861C11E-E952-40B9-AC5C-4E70AA1C235C}.Debug|Any CPU.Build.0 = Debug|Any CPU
75+
{8861C11E-E952-40B9-AC5C-4E70AA1C235C}.Release|Any CPU.ActiveCfg = Release|Any CPU
76+
{8861C11E-E952-40B9-AC5C-4E70AA1C235C}.Release|Any CPU.Build.0 = Release|Any CPU
7177
EndGlobalSection
7278
GlobalSection(SolutionProperties) = preSolution
7379
HideSolutionNode = FALSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Logitar.Identity.EntityFrameworkCore.PostgreSQL;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.Extensions.Configuration;
4+
using Microsoft.Extensions.DependencyInjection;
5+
6+
namespace Logitar.Cms.Infrastructure.PostgreSQL;
7+
8+
public static class DependencyInjectionExtensions
9+
{
10+
private const string ConfigurationKey = "POSTGRESQLCONNSTR_Cms";
11+
12+
public static IServiceCollection AddLogitarCmsWithPostgreSQL(this IServiceCollection services, IConfiguration configuration)
13+
{
14+
string? connectionString = Environment.GetEnvironmentVariable(ConfigurationKey);
15+
if (string.IsNullOrWhiteSpace(connectionString))
16+
{
17+
connectionString = configuration.GetValue<string>(ConfigurationKey);
18+
}
19+
if (string.IsNullOrWhiteSpace(connectionString))
20+
{
21+
throw new ArgumentException($"The configuration '{ConfigurationKey}' could not be found.", nameof(configuration));
22+
}
23+
return services.AddLogitarCmsWithPostgreSQL(connectionString.Trim());
24+
}
25+
public static IServiceCollection AddLogitarCmsWithPostgreSQL(this IServiceCollection services, string connectionString)
26+
{
27+
return services
28+
.AddDbContext<CmsContext>(options => options.UseNpgsql(connectionString, builder => builder.MigrationsAssembly("Logitar.Cms.Infrastructure.PostgreSQL")))
29+
.AddLogitarIdentityWithEntityFrameworkCorePostgreSQL(connectionString)
30+
.AddSingleton<ICommandHelper, PostgresCommandHelper>()
31+
.AddSingleton<IQueryHelper, PostgreSQLQueryHelper>();
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Logitar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
8+
<Title>Logitar.Cms.Infrastructure.SqlServer</Title>
9+
<Authors>Francis Pion</Authors>
10+
<Company>Logitar</Company>
11+
<Product>LogitarCMS</Product>
12+
<Description>Provides an implementation of a relational event store to be used with Logitar Content Management System, Entity Framework Core and Microsoft SQL Server.</Description>
13+
<Copyright>© 2025 Logitar All Rights Reserved.</Copyright>
14+
<PackageIcon>logitar_cms.png</PackageIcon>
15+
<PackageReadmeFile>README.md</PackageReadmeFile>
16+
<RepositoryUrl>https://github.com/Logitar/CMS</RepositoryUrl>
17+
<RepositoryType>git</RepositoryType>
18+
<AssemblyVersion>0.1.0.0</AssemblyVersion>
19+
<FileVersion>$(AssemblyVersion)</FileVersion>
20+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
21+
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
22+
<Version>0.1.0</Version>
23+
<NeutralLanguage>en-CA</NeutralLanguage>
24+
<GenerateDocumentationFile>False</GenerateDocumentationFile>
25+
<PackageReleaseNotes>Initial release.</PackageReleaseNotes>
26+
<PackageTags>logitar;cms;efcore;sqlserver;store</PackageTags>
27+
<PackageProjectUrl>https://github.com/Logitar/CMS/tree/main/backend/src/Logitar.Cms.Infrastructure.SqlServer</PackageProjectUrl>
28+
</PropertyGroup>
29+
30+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
31+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
32+
</PropertyGroup>
33+
34+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
35+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
36+
</PropertyGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="Logitar.Identity.EntityFrameworkCore.PostgreSQL" Version="3.0.5" />
40+
</ItemGroup>
41+
42+
<ItemGroup>
43+
<ProjectReference Include="..\Logitar.Cms.Infrastructure\Logitar.Cms.Infrastructure.csproj" />
44+
</ItemGroup>
45+
46+
<ItemGroup>
47+
<None Update="LICENSE">
48+
<PackagePath>\</PackagePath>
49+
<Pack>True</Pack>
50+
</None>
51+
<None Update="logitar_cms.png">
52+
<PackagePath>\</PackagePath>
53+
<Pack>True</Pack>
54+
</None>
55+
<None Update="README.md">
56+
<PackagePath>\</PackagePath>
57+
<Pack>True</Pack>
58+
</None>
59+
</ItemGroup>
60+
61+
</Project>

0 commit comments

Comments
 (0)