Skip to content

Commit 5ddcb2c

Browse files
Lanning, MarkLanning, Mark
authored andcommitted
Add copyright headers and update dependencies
Added copyright headers to multiple files for Starlight Software Co. Updated `SequentialGuid.cs` to simplify namespace usage. Removed `Audit` references and added `JsonDiffPatch.Net` to `ThingsLibrary.Database.csproj`. Added `JsonPatch.Net` to `ThingsLibrary.Entity.csproj`. Updated `Serilog.Extensions.Hosting` to version 10.0.0. Introduced `IResourceKey` interface. Reintroduced `AppService` class with state and metrics management. Improved `scopes` handling in `CanvasAuth.cs` with null-conditional operators.
1 parent cfeec9d commit 5ddcb2c

File tree

8 files changed

+60
-25
lines changed

8 files changed

+60
-25
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ================================================================================
2+
// <copyright file="IResourceKey.cs" company="Starlight Software Co">
3+
// Copyright (c) Starlight Software Co. All rights reserved.
4+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
5+
// </copyright>
6+
// ================================================================================
7+
8+
namespace ThingsLibrary.Interfaces
9+
{
10+
/// <summary>
11+
/// Basic Interface making sure the class has a standard hierarchical 'Key' field
12+
/// </summary>
13+
public interface IResourceKey
14+
{
15+
/// <summary>
16+
/// Record Hierarchical Key ('/' delimited)
17+
/// </summary>
18+
public string ResourceKey { get; }
19+
}
20+
}

Base/tests/ThingsLibrary.Base.Tests/DataType/SequentialGuid.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
using System.Collections.Generic;
1+
// ================================================================================
2+
// <copyright file="SequentialGuid.cs" company="Starlight Software Co">
3+
// Copyright (c) Starlight Software Co. All rights reserved.
4+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
5+
// </copyright>
6+
// ================================================================================
7+
28
using System.Data.SqlTypes;
9+
using ThingsLibrary.DataType;
310

411
namespace ThingsLibrary.Tests.DataType
512
{
@@ -14,7 +21,7 @@ public void Validate()
1421
// generate 1000 items to test with
1522
for (int i = 0; i < 1000; i++)
1623
{
17-
var value = ThingsLibrary.DataType.SequentialGuid.NewGuid();
24+
var value = SequentialGuid.NewGuid();
1825

1926
list.Add(value);
2027
}

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,9 @@
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>
3724

3825
<ItemGroup>
26+
<PackageReference Include="JsonDiffPatch.Net" Version="2.5.0" />
3927
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.0" />
4028
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
4129
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="10.0.0" />

Entity/src/ThingsLibrary.Entity/ThingsLibrary.Entity.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24+
<PackageReference Include="JsonPatch.Net" Version="3.3.0" />
2425
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
2526
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
2627
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="10.0.0" />

Security/tests/ThingsLibrary.Security.OAuth2.Tests/OAuth2Token.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
// ================================================================================
2+
// <copyright file="OAuth2Token.cs" company="Starlight Software Co">
3+
// Copyright (c) Starlight Software Co. All rights reserved.
4+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
5+
// </copyright>
6+
// ================================================================================
7+
18
using static Microsoft.ApplicationInsights.MetricDimensionNames.TelemetryContext;
29

310
namespace ThingsLibrary.Security.OAuth2.Tests

Services/src/ThingsLibrary.Services.AspNetCore/Extensions/CanvasAuth.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ public static void AddCanvasAuthAzureAd(this IServiceCollection services, Authen
224224

225225
if (azureAdOptions.Tags.ContainsKey("scopes"))
226226
{
227-
var scopes = azureAdOptions["scopes"].Split(' ', StringSplitOptions.RemoveEmptyEntries);
228-
scopes.ForEach<string>(x => options.Scope.Add(x));
227+
var scopes = azureAdOptions["scopes"]?.Split(' ', StringSplitOptions.RemoveEmptyEntries);
228+
scopes?.ForEach<string>(x => options.Scope.Add(x));
229229
}
230230
});
231231

Services/src/ThingsLibrary.Services.AspNetCore/AppService.cs renamed to Services/src/ThingsLibrary.Services/AppService.cs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
// ================================================================================
77

88
using System.Reflection;
9+
using Microsoft.Extensions.Localization;
910
using ThingsLibrary.Metrics;
11+
using ThingsLibrary.Schema.Library;
1012

1113
namespace ThingsLibrary.Services.AspNetCore
1214
{
@@ -57,6 +59,16 @@ public bool IsDebug
5759
}
5860
}
5961

62+
/// <summary>
63+
/// Supported Languages
64+
/// </summary>
65+
public string[] SupportedLanguages { get; set; } = new[] { "en-US" };
66+
67+
/// <summary>
68+
/// String Localizer
69+
/// </summary>
70+
//public IStringLocalizer Localizer { get; set; }
71+
6072
/// <summary>
6173
/// Flag to indicate if this instance is ready for requests
6274
/// </summary>
@@ -158,8 +170,8 @@ public RootItemDto GetMetrics(int ttl = 30)
158170

159171
var rootMetrics = new RootItemDto
160172
{
161-
Key = "instance",
162-
Type = "app_instance",
173+
Key = "$instance",
174+
Type = "$app_instance",
163175
Name = this.Name,
164176

165177
Tags = new Dictionary<string, string>
@@ -177,8 +189,8 @@ public RootItemDto GetMetrics(int ttl = 30)
177189
//assembly metrics
178190
var assemblyItem = new RootItemDto
179191
{
180-
Key = "assembly",
181-
Type = "app_assembly",
192+
Key = "$assembly",
193+
Type = "$app_assembly",
182194
Name = this.Assembly.Name(),
183195

184196
Tags = new Dictionary<string, string>()
@@ -221,8 +233,8 @@ public RootItemDto GetMetrics(int ttl = 30)
221233
// machine metrics
222234
var machineItem = new RootItemDto
223235
{
224-
Key = "machine",
225-
Type = "app_machine",
236+
Key = "$machine",
237+
Type = "$app_machine",
226238
Name = MachineMetrics.MachineName(),
227239

228240
Tags = new Dictionary<string, string>()
@@ -282,7 +294,7 @@ public RootItemDto GetHeartbeatMetrics(int ttl = 30)
282294
// since we are going to the trouble keep track of it
283295
var memoryItem = new RootItemDto
284296
{
285-
Key = $"hb_{dateTime.ToUnixTimeSeconds()}",
297+
Key = $"$hb_{dateTime.ToUnixTimeSeconds()}",
286298

287299
Type = "app_instance_hb",
288300
Name = "Instance Heartbeat",

Services/src/ThingsLibrary.Services/ThingsLibrary.Services.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
3636
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="10.0.0" />
3737
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.0" />
38-
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
38+
<PackageReference Include="Serilog.Extensions.Hosting" Version="10.0.0" />
3939
<PackageReference Include="Serilog.Settings.Configuration" Version="10.0.0" />
4040
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
4141
<PackageReference Include="ThingsLibrary.Schema.Library" Version="0.6.1" />

0 commit comments

Comments
 (0)