-
Notifications
You must be signed in to change notification settings - Fork 85
VB.NET Install Notes
If you want to run the Data Annotations Extensions MVC3 Nuget Package with VB.NET, you need to add a little bit of code so the new validators are initialized properly when your application starts.
The easiest method is to just call the initialize method from inside your Global.asax file inside the Application_Start method, like so:
DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions()
If you want to see a this in the context of a full global.asax file in MVC3, you can look at this gist. (Line 31 in particular)
If you would rather initialize the validators within your App_Start folder (using Web Activator), then you can make a new file inside your App_Start folder using the following code: (See the gist here)
Imports DataAnnotationsExtensions.ClientValidation
<Assembly: WebActivator.PreApplicationStartMethod(GetType(App_Start.RegisterClientValidationExtensions), "Start")>
Namespace App_Start
Public NotInheritable Class RegisterClientValidationExtensions
Private Sub New()
End Sub
Public Shared Sub Start()
DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions()
End Sub
End Class
End Namespace