首页->企业网站->中小企业网站系统前台源码(SmallBusinessStarterKit)>>smallbusiness_vb/App-Code/ProviderSettingsValidation.vb>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:中小企业网站系统前台源码(SmallBusinessStarterKit)
当前文件:
SmallBusinessStarterKit/smallbusiness_vb/App_Code/ProviderSettingsValidation.vb[1K,2009-6-12 11:54:22],打开代码结构图
SmallBusinessStarterKit/smallbusiness_vb/App_Code/ProviderSettingsValidation.vb[1K,2009-6-12 11:54:22],打开代码结构图1Imports System 2
Imports System.Configuration 3
4
'/ <summary> 5
' ensures the providerCollection contains a set of ProviderSettings, where each one 6
' "is a " Provider 7
'/ </summary> 8
Public Class ProviderSettingsValidation 9
Inherits ConfigurationValidatorBase 10
11
12
Public Overrides Function CanValidate(ByVal type As Type) As Boolean 13
Return GetType(ProviderSettingsCollection).Equals(type) 14
End Function 'CanValidate 15
16
17
'/ <summary> 18
' validate the provider section 19
'/ </summary> 20
Public Overrides Sub Validate(ByVal value As Object) 21
Dim providerCollection As ProviderSettingsCollection = value 22
If Not (providerCollection Is Nothing) Then 23
Dim _provider As ProviderSettings 24
For Each _provider In providerCollection 25
26
If [String].IsNullOrEmpty(_provider.Type) Then 27
Throw New ConfigurationErrorsException("Type was not defined in the provider") 28
End If 29
30
Dim dataAccessType As Type = Type.GetType(_provider.Type) 31
If dataAccessType Is Nothing Then 32
Throw New InvalidOperationException("Provider's Type could not be found") 33
End If 34
Next _provider 35
End If 36
End Sub 'Validate 37
End Class 'ProviderSettingsValidation







