Added White-/Blacklist Attributes, DateOnly/TimeOnly converters, TcpClientMoq
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AMWD.Common.EntityFrameworkCore.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the conversion from a <see cref="TimeOnly"/> object to a <see cref="TimeSpan"/> which can be handled by the database engine.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// As of 2022-06-04 only required for Microsoft SQL server on .NET 6.0.
|
||||
/// </remarks>
|
||||
public class TimeOnlyConverter : ValueConverter<TimeOnly, TimeSpan>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TimeOnlyConverter"/> class.
|
||||
/// </summary>
|
||||
public TimeOnlyConverter()
|
||||
: base(
|
||||
t => t.ToTimeSpan(),
|
||||
t => TimeOnly.FromTimeSpan(t)
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user