mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-18 22:31:08 +08:00
ae7a29a9f1
Due to the way VS test works (by injecting an executable entry point), the performance tests needed to be factored out. I also organized all of our existing tests better along the way. Actual code changes to Dapper itself are very minor, only formatting and documentation fixes (which we need many more of). The build.ps1 script is upated to work, but note that <frameworkAssemblies> is not working in .nuspec inside the packages in the new .csproj system. I consider this to be a blocker. Issue is here: https://github.com/NuGet/Home/issues/4853
29 lines
741 B
C#
29 lines
741 B
C#
using System;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace Dapper.Tests.Performance
|
|
{
|
|
public static class SqlDataReaderHelper
|
|
{
|
|
public static string GetNullableString(this SqlDataReader reader, int index)
|
|
{
|
|
object tmp = reader.GetValue(index);
|
|
if (tmp != DBNull.Value)
|
|
{
|
|
return (string)tmp;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static T? GetNullableValue<T>(this SqlDataReader reader, int index) where T : struct
|
|
{
|
|
object tmp = reader.GetValue(index);
|
|
if (tmp != DBNull.Value)
|
|
{
|
|
return (T)tmp;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|