Private _bgWorker As BackgroundWorker = Nothing
Private _bgWorkerMessage As String = String.Empty
Private _bgPercentComplete As Integer = 0
Private _dictQueries As Dictionary(Of String, String) = New Dictionary(Of String, String)
Public Sub New()
_dictQueries.Add("IPB", "")
_dictQueries.Add("Figure", "")
_dictQueries.Add("Part", "")
_dictQueries.Add("Tags", "")
End Sub
Public Sub New(ByRef bgWorker As BackgroundWorker)
Me.New()
_bgWorker = bgWorker
End Sub
Public Sub New(ByVal dictQueries As Dictionary(Of String, String))
Me.New()
If Not dictQueries.ContainsKey("IPB") Or Not dictQueries.ContainsKey("Figure") Or Not dictQueries.ContainsKey("Part") Or Not dictQueries.ContainsKey("Tags") Then
'I want to throw an exception/warning right here, or make it error out'
End If
_dictQueries = dictQueries
End Sub
Public Sub New(ByRef bgWorker As BackgroundWorker, ByVal dictQueries As Dictionary(Of String, String))
Me.New(bgWorker)
If Not dictQueries.ContainsKey("IPB") Or Not dictQueries.ContainsKey("Figure") Or Not dictQueries.ContainsKey("Part") Or Not dictQueries.ContainsKey("Tags") Then
'I want to throw an exception/warning right here, or make it error out'
End If
_dictQueries = dictQueries
End Sub
My goal is to make a class that can import the same file type and structure to any database as long as a connection and queries are set. We have a "common" database schema, but whenever we create SQLite apps, it's not guaranteed that the developer will use the same schema. So, in the main constructor, I'm going to define the common queries. But if they define the queries, I want to make sure there are four specific ones as those will be the only ones I use. Now, I wanted to check it in the constructor so that maybe the developer would catch it. It's pointless for the user to catch it, cause then the product shouldn't have been released. So, is there a way to check a parameter on a constructor to make sure it is "valid". I know Visual Studio does this automatically with type, but I don't know if there's a way to check the values to make sure they're what's needed. All I want to do is throw a warning rather than keep it from building (they may pass in a value that is built from a database, who knows).