-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move methods
GetNowTimestamp()
& UnescapedJsonSerialize()
& fie…
…ld `JsonSerializerOptions` to `tbm.Shared.BaseHelper` @ Helper.cs @ crawler + static class `BaseHelper` * now will log at warn level and serialize entities count group by type to json @ `TbmDbContext.LogDbUpdateConcurrencyException()` @ shared @ c#
- Loading branch information
Showing
16 changed files
with
42 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Text.Encodings.Web; | ||
using System.Text.Json; | ||
using System.Text.Unicode; | ||
|
||
namespace tbm.Shared; | ||
|
||
#pragma warning disable AV1708 // Type name contains term that should be avoided | ||
public static class BaseHelper | ||
#pragma warning restore AV1708 // Type name contains term that should be avoided | ||
{ | ||
public static void GetNowTimestamp(out UInt32 now) => now = GetNowTimestamp(); | ||
[SuppressMessage("Maintainability", "AV1551:Method overload should call another overload")] | ||
public static UInt32 GetNowTimestamp() => (UInt32)DateTimeOffset.Now.ToUnixTimeSeconds(); | ||
|
||
private static readonly JsonSerializerOptions UnescapedSerializeOptions = | ||
Check failure on line 16 in c#/shared/BaseHelper.cs GitHub Actions / build (crawler)
Check failure on line 16 in c#/shared/BaseHelper.cs GitHub Actions / build (crawler)
Check failure on line 16 in c#/shared/BaseHelper.cs GitHub Actions / build (imagePipeline)
Check failure on line 16 in c#/shared/BaseHelper.cs GitHub Actions / build (imagePipeline)
Check failure on line 16 in c#/shared/BaseHelper.cs GitHub Actions / build (shared)
Check failure on line 16 in c#/shared/BaseHelper.cs GitHub Actions / build (shared)
|
||
new() {Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)}; | ||
public static string UnescapedJsonSerialize<TValue>(TValue value) => | ||
JsonSerializer.Serialize(value, UnescapedSerializeOptions); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters