예제 #1
0
 public static ByTypeHelpers Get(Type type)
 {
     if (!s_byType.TryGetValue(type, out var value))
     {
         s_byType[type] = value = new ByTypeHelpers(type);
     }
     return(value);
 }
예제 #2
0
 /// <summary>
 /// Clear the pools associated with the provided connection
 /// </summary>
 public static bool TryClearPool(this DbConnection connection)
 => connection != null && ByTypeHelpers.Get(connection.GetType()).TryClearPool(connection);
예제 #3
0
 /// <summary>
 /// Indicates whether the provided exception has an integer Number property with the supplied value
 /// </summary>
 public static bool IsNumber(this DbException exception, int number)
 => exception != null && ByTypeHelpers.Get(exception.GetType()).IsNumber(exception, number);
예제 #4
0
 /// <summary>
 /// Attempt to get the client connection id for a given connection
 /// </summary>
 public static bool TryGetClientConnectionId(this DbConnection connection, out Guid clientConnectionId)
 {
     clientConnectionId = default;
     return(connection != null && ByTypeHelpers.Get(connection.GetType()).TryGetClientConnectionId(
                connection, out clientConnectionId));
 }