Add a lot of functions to Base
This commit is contained in:
16
Base/DatabaseEx.vb
Normal file
16
Base/DatabaseEx.vb
Normal file
@@ -0,0 +1,16 @@
|
||||
Public Class DatabaseEx
|
||||
''' <summary>
|
||||
''' Checks a Row value for three different `null` values,
|
||||
''' Nothing, Empty String, DBNull
|
||||
'''
|
||||
''' Returns the original value if the value is not null, or `defaultValue`
|
||||
''' </summary>
|
||||
''' <typeparam name="T">The type of the value</typeparam>
|
||||
''' <param name="Row">The DataRow that contains the value</param>
|
||||
''' <param name="Column">The column name</param>
|
||||
''' <param name="DefaultValue">The default value</param>
|
||||
''' <returns>The original value or the default value</returns>
|
||||
Public Shared Function NotNull(Of T)(ByVal Row As DataRow, Column As String, DefaultValue As T) As T
|
||||
Return ObjectEx.NotNull(Row.Item(Column), DefaultValue)
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user