Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit c7e80c3

Browse files
committed
Added database storage descriptors
1 parent 93adc66 commit c7e80c3

File tree

8 files changed

+70
-0
lines changed

8 files changed

+70
-0
lines changed

src/JasperFx.Core.Tests/JasperFx.Core.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<LangVersion>latest</LangVersion>
78
</PropertyGroup>
89

910
<ItemGroup>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
namespace JasperFx.Core.Descriptions;
2+
3+
public enum DatabaseUsage
4+
{
5+
/// <summary>
6+
/// No database usage here of any sort
7+
/// </summary>
8+
None,
9+
10+
/// <summary>
11+
/// Using a single database regardless of tenancy
12+
/// </summary>
13+
Single,
14+
15+
/// <summary>
16+
/// Using a static number of databases
17+
/// </summary>
18+
StaticMultiple,
19+
20+
/// <summary>
21+
/// Using a dynamic number of databases that should
22+
/// be expected to potentially change at runtime
23+
/// </summary>
24+
DynamicMultiple
25+
}
26+
27+
public class DatabaseCapability : OptionsDescription
28+
{
29+
public DatabaseUsage Usage { get; set; } = DatabaseUsage.Single;
30+
31+
// Also holds tenants
32+
public List<DatabaseDescription> Databases { get; set; } = [];
33+
}
34+
35+
public class DatabaseDescription : OptionsDescription
36+
{
37+
/// <summary>
38+
/// Identifier within the Wolverine system
39+
/// </summary>
40+
public string Identifier { get; set; } = "Default";
41+
42+
/// <summary>
43+
/// Descriptive name for the database engine. Example: "SqlServer" or "PostgreSQL"
44+
/// </summary>
45+
public string DatabaseEngine { get; set; }
46+
47+
public List<string> TenantIds { get; set; } = new();
48+
}
49+
50+
// This definitely goes into JasperFx.Core. Also need a way to
51+
// get out tenanted message stores too though. Put something separate
52+
// in Weasel for multi-tenancy for EF Core that can generate databases
53+
public interface IDatabaseUser
54+
{
55+
DatabaseUsage Usage { get; }
56+
57+
/// <summary>
58+
/// Evaluate the databases used at runtime
59+
/// </summary>
60+
/// <param name="token"></param>
61+
/// <returns></returns>
62+
ValueTask<IReadOnlyList<DatabaseDescription>> DescribeDatabasesAsync(CancellationToken token);
63+
}

src/JasperFx.Core/JasperFx.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<Authors>Jeremy D. Miller</Authors>
77
<AssemblyName>JasperFx.Core</AssemblyName>
88
<PackageId>JasperFx.Core</PackageId>
9+
<LangVersion>latest</LangVersion>
910

1011
</PropertyGroup>
1112

src/Widgets1/Widgets1.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
5+
<LangVersion>latest</LangVersion>
56
</PropertyGroup>
67

78
<ItemGroup>

src/Widgets2/Widgets2.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
5+
<LangVersion>latest</LangVersion>
56
</PropertyGroup>
67

78
<ItemGroup>

src/Widgets3/Widgets3.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
5+
<LangVersion>latest</LangVersion>
56
</PropertyGroup>
67

78
<ItemGroup>

src/Widgets4/Widgets4.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
4+
<LangVersion>latest</LangVersion>
45
</PropertyGroup>
56

67
<ItemGroup>

src/Widgets5/Widgets5.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
5+
<LangVersion>latest</LangVersion>
56
</PropertyGroup>
67

78
<ItemGroup>

0 commit comments

Comments
 (0)