Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

Created Unassigned: [Validator(typeof(MyModelValidator))] [7139]

$
0
0
Get error on [Validator(typeof(NewMessageValidator))], it says that it isn't a valid attribute.
Got the latest version on nuget (3.4.6.0), added FluentValidation, FluentValidation.MVC4. And because it didn't work i added FluentValidation.MVC3 aswell.. But it didn't changed anything. Im running MVC4 so proberly i dont need mvc3 package..

Everything else works, it validates with my rules.
```
namespace MobileWeb.Models.ViewModels
{
[Validator(typeof(NewMessageValidator))]
public class NewMessageViewModel
{
public List<UserWeb> UserList { get; set; }
public List<UserWeb> PersonList { get; set; }
public string MessageText { get; set; }
public string MessageHeader { get; set; }
public string Title { get; set; }
public string ShowDataFilterUser { get; set; }
public string ShowDataFilterPerson { get; set; }
public List<int> CheckedUsers { get; set; }
public List<int> CheckedPersons { get; set; }
}
}
```
My global.asax.cs looks like this:
```
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();

WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);

FluentValidationModelValidatorProvider.Configure(x =>
{
x.AddImplicitRequiredValidator = false;
});
}
```
btw what does this line: x.AddImplicitRequiredValidator = false; ?
Seen alot of examples witout my x.



Viewing all articles
Browse latest Browse all 1917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>