예제 #1
0
        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()));
 }
예제 #3
0
 public static Guid ReadGuidFromBlob(this IResultSetValue result)
 {
     // TODO: Remove ToArray when upgrading to netstandard2.1
     return(new Guid(result.ToBlob().ToArray()));
 }
예제 #4
0
 public static bool IsDbNull(this IResultSetValue result)
 {
     return(result.SQLiteType == SQLiteType.Null);
 }
예제 #5
0
 /// <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());
 }
예제 #6
0
 /// <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());
 }
예제 #7
0
 /// <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());
 }
예제 #8
0
 /// <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());
 }
예제 #9
0
 /// <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());
 }