Skip to content

Commit 9427747

Browse files
Lanning, MarkLanning, Mark
authored andcommitted
updated with notifications and database wrappers.
1 parent 45174d6 commit 9427747

File tree

9 files changed

+70
-19
lines changed

9 files changed

+70
-19
lines changed

Database/src/ThingsLibrary.Database.SqlServer/Extensions/Database.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public static IServiceCollection AddDatabaseSqlServer<TContext>(this IServiceCol
4242
// verify a SQL connection can be established before continuing
4343
using (var connection = new SqlConnection(connectionString))
4444
{
45-
Log.Information("Testing SQL Connection to {SqlDatabaseServer}...", connection.DataSource);
45+
Console.WriteLine("Testing SQL Connection to {SqlDatabaseServer}...", connection.DataSource);
4646
connection.Open();
4747

48-
Log.Information("+ SQL Server: {SqlDatabaseServer} ", connection.DataSource);
49-
Log.Information("+ SQL Database: {SqlDatabaseName}", connection.Database);
48+
Console.WriteLine("+ SQL Server: {SqlDatabaseServer} ", connection.DataSource);
49+
Console.WriteLine("+ SQL Database: {SqlDatabaseName}", connection.Database);
5050
}
5151

5252
services.AddDbContext<TContext>(builder => builder.Configure<TContext>(connectionString));

Database/src/ThingsLibrary.Database.SqlServer/ThingsLibrary.Database.SqlServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net9.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>true</IsPackable>

Database/src/ThingsLibrary.Database.SqlServer/Usings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// ================================================================================
2626
// THIRD PARTY
2727
// ================================================================================
28-
global using Serilog;
28+
2929

3030
// ================================================================================
3131
// LOCAL

Database/src/ThingsLibrary.Database/DataContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
6363
// include all of the services fluent API configurations
6464
var baseAssembly = typeof(DataContext).Assembly;
6565

66-
Log.Information($"= Applying {baseAssembly.GetName().Name} ({baseAssembly.GetName().Version}) Configurations...");
66+
Console.WriteLine($"= Applying {baseAssembly.GetName().Name} ({baseAssembly.GetName().Version}) Configurations...");
6767
modelBuilder.ApplyConfigurationsFromAssembly(baseAssembly);
6868

6969
var assembly = this.GetType().Assembly;
7070
if (assembly != baseAssembly)
7171
{
72-
Log.Information($"= Applying {assembly.GetName().Name} ({assembly.GetName().Version}) Configurations...");
72+
Console.WriteLine($"= Applying {assembly.GetName().Name} ({assembly.GetName().Version}) Configurations...");
7373
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
7474
}
7575

7676
//turn off default OnDelete:cascade
77-
Log.Information($"= Restricting Delete behaviors...");
77+
Console.WriteLine($"= Restricting Delete behaviors...");
7878
foreach (var relationship in modelBuilder.Model.GetEntityTypes().SelectMany(e => e.GetForeignKeys()))
7979
{
8080
relationship.DeleteBehavior = DeleteBehavior.Restrict;

Services/src/ThingsLibrary.Services/Extensions/Configuration.cs renamed to Database/src/ThingsLibrary.Database/Extensions/Configuration.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,30 @@ public static string TryGetConnectionString(this IConfiguration configuration, s
2121
{
2222
if (string.IsNullOrEmpty(connectionStringName)) { throw new ArgumentNullException(nameof(connectionStringName)); }
2323

24-
Log.Debug("Getting connection string '{ConnectionStringName}'...", connectionStringName);
24+
Console.WriteLine("Getting connection string '{ConnectionStringName}'...", connectionStringName);
2525
var connectionString = configuration.GetConnectionString(connectionStringName);
2626
if (string.IsNullOrEmpty(connectionString))
2727
{
28-
Log.Debug("Not Found; Trying to get '{ConnectionStringName}' with Prefix...", $"CUSTOMCONNSTR_{connectionStringName}");
28+
Console.WriteLine("Not Found; Trying to get '{ConnectionStringName}' with Prefix...", $"CUSTOMCONNSTR_{connectionStringName}");
2929
connectionString = configuration.GetConnectionString($"CUSTOMCONNSTR_{connectionStringName}");
3030
}
3131

3232
if (string.IsNullOrEmpty(connectionString))
3333
{
34-
Log.Debug("Not Found; Trying to get '{ConnectionStringName}' from environment variables...", connectionStringName);
34+
Console.WriteLine("Not Found; Trying to get '{ConnectionStringName}' from environment variables...", connectionStringName);
3535
connectionString = Environment.GetEnvironmentVariable(connectionStringName);
3636
}
3737

3838
if (string.IsNullOrEmpty(connectionString))
3939
{
40-
Log.Debug("Not Found; Trying to get '{ConnectionStringName}' from environment variables with prefix...", connectionStringName);
40+
Console.WriteLine("Not Found; Trying to get '{ConnectionStringName}' from environment variables with prefix...", connectionStringName);
4141
connectionString = Environment.GetEnvironmentVariable($"CUSTOMCONNSTR_{connectionStringName}");
4242
}
4343

4444
// STILL NOT FOUND??!?!?
4545
if (string.IsNullOrEmpty(connectionString))
4646
{
47-
Log.Warning("Connection string '{ConnectionStringName}' not found!", connectionStringName);
47+
Console.WriteLine("Connection string '{ConnectionStringName}' not found!", connectionStringName);
4848
throw new ArgumentException($"Unable to find connection string '{connectionStringName}'");
4949
}
5050

Database/src/ThingsLibrary.Database/ThingsLibrary.Database.csproj

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net9.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>true</IsPackable>
@@ -21,15 +21,28 @@
2121
<RepositoryType>git</RepositoryType>
2222
<RepositoryUrl>https://github.com/things-library/Frameworks</RepositoryUrl>
2323
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<Compile Remove="Audit\**" />
27+
<EmbeddedResource Remove="Audit\**" />
28+
<None Remove="Audit\**" />
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<Compile Include="Audit\AuditClient.cs" />
33+
<Compile Include="Audit\AuditEvent.cs" />
34+
<Compile Include="Audit\AuditType.cs" />
35+
<Compile Include="Audit\AuditUser.cs" />
36+
</ItemGroup>
2437

2538
<ItemGroup>
2639
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
2740
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.8" />
2841
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="9.0.8" />
2942
</ItemGroup>
30-
43+
3144
<ItemGroup>
32-
<ProjectReference Include="..\..\..\Services\src\ThingsLibrary.Services\ThingsLibrary.Services.csproj" />
45+
<ProjectReference Include="..\..\..\Base\src\ThingsLibrary.Base\ThingsLibrary.csproj" />
3346
</ItemGroup>
3447

3548
</Project>

Database/src/ThingsLibrary.Database/Usings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
// ================================================================================
2727
// THIRD PARTY
2828
// ================================================================================
29-
global using Serilog;
3029

3130
// ================================================================================
3231
// LOCAL

Database/tests/ThingsLibrary.Database.Tests/ThingsLibrary.Database.Tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
</ItemGroup>
2121

2222
<ItemGroup>
23-
<ProjectReference Include="..\..\..\Base\src\ThingsLibrary.Testing\ThingsLibrary.Testing.csproj" />
24-
<ProjectReference Include="..\..\src\ThingsLibrary.Database\ThingsLibrary.Database.csproj" />
23+
<ProjectReference Include="..\..\src\ThingsLibrary.Database\ThingsLibrary.Database.csproj" />
2524
</ItemGroup>
2625

2726
<ItemGroup>

ThingsLibrary.Frameworks.sln

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsLibrary.Services.Test
5959
EndProject
6060
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{849E04AD-AF77-480E-841C-9F7F9D567A6E}"
6161
EndProject
62+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notifications", "Notifications", "{2765E029-1979-4E1B-BA88-3B319E11DA85}"
63+
EndProject
64+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsLibrary.Notification", "Notifications\src\ThingsLibrary.Notification\ThingsLibrary.Notification.csproj", "{B85EAE8C-5367-CAD0-1604-1BDF491B4E54}"
65+
EndProject
66+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsLibrary.Notification.Azure", "Notifications\src\ThingsLibrary.Notifications.Azure\ThingsLibrary.Notification.Azure.csproj", "{2AE31A06-45C7-7512-DBA1-6F6E6417C4FA}"
67+
EndProject
68+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsLibrary.Database", "Database\src\ThingsLibrary.Database\ThingsLibrary.Database.csproj", "{64DF7009-D2E5-E8AC-AE2A-CF49A86A711C}"
69+
EndProject
70+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsLibrary.Database.SqlServer", "Database\src\ThingsLibrary.Database.SqlServer\ThingsLibrary.Database.SqlServer.csproj", "{54C7FECD-27CB-2322-BA28-B2278E39526D}"
71+
EndProject
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3B22F8CC-5485-40EE-909C-23D130F140B9}"
73+
EndProject
74+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsLibrary.Database.Tests", "Database\tests\ThingsLibrary.Database.Tests\ThingsLibrary.Database.Tests.csproj", "{4E8EAE34-4F80-655D-5132-4A7B5888CE78}"
75+
EndProject
6276
Global
6377
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6478
Debug|Any CPU = Debug|Any CPU
@@ -117,6 +131,26 @@ Global
117131
{6D5C0ECF-13A4-0487-6BA5-E639A7E31092}.Debug|Any CPU.Build.0 = Debug|Any CPU
118132
{6D5C0ECF-13A4-0487-6BA5-E639A7E31092}.Release|Any CPU.ActiveCfg = Release|Any CPU
119133
{6D5C0ECF-13A4-0487-6BA5-E639A7E31092}.Release|Any CPU.Build.0 = Release|Any CPU
134+
{B85EAE8C-5367-CAD0-1604-1BDF491B4E54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
135+
{B85EAE8C-5367-CAD0-1604-1BDF491B4E54}.Debug|Any CPU.Build.0 = Debug|Any CPU
136+
{B85EAE8C-5367-CAD0-1604-1BDF491B4E54}.Release|Any CPU.ActiveCfg = Release|Any CPU
137+
{B85EAE8C-5367-CAD0-1604-1BDF491B4E54}.Release|Any CPU.Build.0 = Release|Any CPU
138+
{2AE31A06-45C7-7512-DBA1-6F6E6417C4FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
139+
{2AE31A06-45C7-7512-DBA1-6F6E6417C4FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
140+
{2AE31A06-45C7-7512-DBA1-6F6E6417C4FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
141+
{2AE31A06-45C7-7512-DBA1-6F6E6417C4FA}.Release|Any CPU.Build.0 = Release|Any CPU
142+
{64DF7009-D2E5-E8AC-AE2A-CF49A86A711C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
143+
{64DF7009-D2E5-E8AC-AE2A-CF49A86A711C}.Debug|Any CPU.Build.0 = Debug|Any CPU
144+
{64DF7009-D2E5-E8AC-AE2A-CF49A86A711C}.Release|Any CPU.ActiveCfg = Release|Any CPU
145+
{64DF7009-D2E5-E8AC-AE2A-CF49A86A711C}.Release|Any CPU.Build.0 = Release|Any CPU
146+
{54C7FECD-27CB-2322-BA28-B2278E39526D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
147+
{54C7FECD-27CB-2322-BA28-B2278E39526D}.Debug|Any CPU.Build.0 = Debug|Any CPU
148+
{54C7FECD-27CB-2322-BA28-B2278E39526D}.Release|Any CPU.ActiveCfg = Release|Any CPU
149+
{54C7FECD-27CB-2322-BA28-B2278E39526D}.Release|Any CPU.Build.0 = Release|Any CPU
150+
{4E8EAE34-4F80-655D-5132-4A7B5888CE78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
151+
{4E8EAE34-4F80-655D-5132-4A7B5888CE78}.Debug|Any CPU.Build.0 = Debug|Any CPU
152+
{4E8EAE34-4F80-655D-5132-4A7B5888CE78}.Release|Any CPU.ActiveCfg = Release|Any CPU
153+
{4E8EAE34-4F80-655D-5132-4A7B5888CE78}.Release|Any CPU.Build.0 = Release|Any CPU
120154
EndGlobalSection
121155
GlobalSection(SolutionProperties) = preSolution
122156
HideSolutionNode = FALSE
@@ -140,6 +174,12 @@ Global
140174
{621D4C6C-B211-ED2E-538E-37B7CC7A91E9} = {01046A4D-EF64-40BE-8916-70F172E56A2E}
141175
{6D5C0ECF-13A4-0487-6BA5-E639A7E31092} = {849E04AD-AF77-480E-841C-9F7F9D567A6E}
142176
{849E04AD-AF77-480E-841C-9F7F9D567A6E} = {01046A4D-EF64-40BE-8916-70F172E56A2E}
177+
{B85EAE8C-5367-CAD0-1604-1BDF491B4E54} = {2765E029-1979-4E1B-BA88-3B319E11DA85}
178+
{2AE31A06-45C7-7512-DBA1-6F6E6417C4FA} = {2765E029-1979-4E1B-BA88-3B319E11DA85}
179+
{64DF7009-D2E5-E8AC-AE2A-CF49A86A711C} = {AEA7EBFB-4654-45AA-86A7-8331890456C1}
180+
{54C7FECD-27CB-2322-BA28-B2278E39526D} = {AEA7EBFB-4654-45AA-86A7-8331890456C1}
181+
{3B22F8CC-5485-40EE-909C-23D130F140B9} = {AEA7EBFB-4654-45AA-86A7-8331890456C1}
182+
{4E8EAE34-4F80-655D-5132-4A7B5888CE78} = {3B22F8CC-5485-40EE-909C-23D130F140B9}
143183
EndGlobalSection
144184
GlobalSection(ExtensibilityGlobals) = postSolution
145185
SolutionGuid = {9CF34144-3CDD-4955-B934-A5278D7A1139}

0 commit comments

Comments
 (0)