-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Host.Serialization] Introduce multi-targeting for net8, net6 and net…
…standard #211 Signed-off-by: Tomasz Maruszak <[email protected]>
- Loading branch information
Showing
19 changed files
with
146 additions
and
52 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
17 changes: 17 additions & 0 deletions
17
src/SlimMessageBus.Host/Consumer/Checkpointing/CheckpointValue.cs
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,17 @@ | ||
namespace SlimMessageBus.Host; | ||
|
||
public class CheckpointValue | ||
{ | ||
public CheckpointValue() | ||
{ | ||
} | ||
|
||
public CheckpointValue(int checkpointCount, TimeSpan checkpointDuration) | ||
{ | ||
CheckpointCount = checkpointCount; | ||
CheckpointDuration = checkpointDuration; | ||
} | ||
|
||
public int CheckpointCount { get; } | ||
public TimeSpan CheckpointDuration { get; } | ||
}; |
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,52 @@ | ||
namespace SlimMessageBus.Host; | ||
|
||
#if NETSTANDARD2_0 | ||
|
||
/// <summary> | ||
/// Helper for netstandard2.0 | ||
/// </summary> | ||
public static class DictionaryExtensions | ||
{ | ||
public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> keyValuePair, out TKey key, out TValue value) | ||
{ | ||
key = keyValuePair.Key; | ||
value = keyValuePair.Value; | ||
} | ||
|
||
public static bool TryAdd<K, V>(this IDictionary<K, V> dict, K key, V value) | ||
{ | ||
if (!dict.ContainsKey(key)) | ||
{ | ||
dict.Add(key, value); | ||
return true; | ||
} | ||
return false; | ||
} | ||
} | ||
|
||
static internal class HashCode | ||
{ | ||
public static int Combine(object value1, object value2) | ||
{ | ||
unchecked // Overflow is fine, just wrap | ||
{ | ||
var hash = 17; | ||
hash = hash * 23 + value1.GetHashCode(); | ||
hash = hash * 23 + value2.GetHashCode(); | ||
return hash; | ||
} | ||
} | ||
} | ||
|
||
public static class TimeSpanExtensions | ||
{ | ||
public static TimeSpan Multiply(this TimeSpan timeSpan, double factor) | ||
=> TimeSpan.FromMilliseconds(timeSpan.TotalMilliseconds * factor); | ||
} | ||
|
||
public static class CollectionExtensions | ||
{ | ||
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> items) => new HashSet<T>(items); | ||
} | ||
|
||
#endif |
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
Oops, something went wrong.