public static DateTime?TryReadDateTime(this IResultSetValue result) { var dateText = result.ToString(); if (DateTime.TryParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out var dateTimeResult)) { return(dateTimeResult.ToUniversalTime()); } return(null); }
public static Guid ReadGuidFromBlob(this IResultSetValue result) { return(new Guid(result.ToBlob().ToArray())); }
public static Guid ReadGuidFromBlob(this IResultSetValue result) { // TODO: Remove ToArray when upgrading to netstandard2.1 return(new Guid(result.ToBlob().ToArray())); }
public static bool IsDbNull(this IResultSetValue result) { return(result.SQLiteType == SQLiteType.Null); }
/// <summary> /// Converts a value to a nullable <c>float</c>. /// </summary> /// <param name="this"> /// The value to convert. /// </param> /// <returns> /// The <c>float</c>, which may be <see langword="null"/>. /// </returns> public static float?ToNullableFloat(this IResultSetValue @this) { Ensure.ArgumentNotNull(@this, nameof(@this)); return(@this.SQLiteType == SQLiteType.Null ? (float?)null : @this.ToFloat()); }
/// <summary> /// Converts a value to a nullable <c>double</c>. /// </summary> /// <param name="this"> /// The value to convert. /// </param> /// <returns> /// The <c>double</c>, which may be <see langword="null"/>. /// </returns> public static double?ToNullableDouble(this IResultSetValue @this) { Ensure.ArgumentNotNull(@this, nameof(@this)); return(@this.SQLiteType == SQLiteType.Null ? (double?)null : @this.ToDouble()); }
/// <summary> /// Converts a value to a nullable <c>bool</c>. /// </summary> /// <param name="this"> /// The value to convert. /// </param> /// <returns> /// The <c>bool</c>, which may be <see langword="null"/>. /// </returns> public static bool?ToNullableBool(this IResultSetValue @this) { Ensure.ArgumentNotNull(@this, nameof(@this)); return(@this.SQLiteType == SQLiteType.Null ? (bool?)null : @this.ToBool()); }
/// <summary> /// Converts a value to a nullable <c>string</c>. /// </summary> /// <param name="this"> /// The value to convert. /// </param> /// <returns> /// The <c>string</c>, which may be <see langword="null"/>. /// </returns> public static string ToNullableString(this IResultSetValue @this) { Ensure.ArgumentNotNull(@this, nameof(@this)); return(@this.SQLiteType == SQLiteType.Null ? null : @this.ToString()); }
/// <summary> /// Converts a value to a nullable <c>long</c>. /// </summary> /// <param name="this"> /// The value to convert. /// </param> /// <returns> /// The <c>long</c>, which may be <see langword="null"/>. /// </returns> public static long?ToNullableInt64(this IResultSetValue @this) { Ensure.ArgumentNotNull(@this, nameof(@this)); return(@this.SQLiteType == SQLiteType.Null ? (long?)null : @this.ToInt64()); }