-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert removal of templatized TValue dapper handler
This breaks the Ulid scenario otherwise. Adapt test to ensure we're using this template in the test so we never drop it in the future.
- Loading branch information
Showing
2 changed files
with
28 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// <auto-generated /> | ||
#nullable enable | ||
|
||
using System; | ||
using System.Data; | ||
using System.Diagnostics.CodeAnalysis; | ||
using StructId; | ||
|
||
// TODO: pending making it conditionally included at compile-time | ||
[TValue] | ||
file class TValue_TypeHandler : Dapper.SqlMapper.TypeHandler<TValue> | ||
{ | ||
public override TValue Parse(object value) => TValue.Parse((string)value, null); | ||
|
||
public override void SetValue(IDbDataParameter parameter, TValue value) | ||
{ | ||
parameter.DbType = DbType.String; | ||
parameter.Value = value.ToString(null, null); | ||
} | ||
} | ||
|
||
file partial struct TValue : IParsable<TValue>, IFormattable | ||
{ | ||
public static TValue Parse(string s, IFormatProvider? provider) => throw new NotImplementedException(); | ||
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out TValue result) => throw new NotImplementedException(); | ||
public string ToString(string? format, IFormatProvider? formatProvider) => throw new NotImplementedException(); | ||
} |