Given types:
```
class User
{
public int Id { get; set; }
public string Name { get; set; }
}
class Role
{
public string Name { get; set; }
public IList<string> AllowedOperations { get; set; }
public IList<User> Users { get; set; }
}
```
and validators:
```
class UserValidator : AbstractValidator<User>
{
public UserValidator()
{
RuleFor(x => x.Id)
.NotEmpty();
}
}
class RoleValidator : AbstractValidator<Role>
{
public RoleValidator()
{
// SetCollectionValidator compiles but doesn't show up in IntelliSense
RuleFor(x => x.Users)
.SetCollectionValidator(new UserValidator());
}
}
```
Addition of following extension method to base AbstractValidator would solve this problem:
```
protected IRuleBuilderInitial<Role, IEnumerable<TProperty>> RuleFor<TProperty>(Expression<Func<Role, IEnumerable<TProperty>>> expression)
{
return base.RuleFor<IEnumerable<TProperty>>(expression);
}
```
This behavior can be confusing for inexperienced programmers, on my team I had problem with younger programmer who tried to use RuleForEach instead of RuleFor+SetCollectionValidator because 'it didn't show up in IntelliSense'. Please consider also improving documentation on RuleForEach method.
Comments: Hi I'm afraid I still can't reproduce the problem. I tried opening your solution in a clean install of visual studio (no resharper) and the SetCollectionValidator method appears in intellisense correctly. (Screenshot attached) I'm not quite sure what else to suggest...are you sure that you don't have any plug-ins installed that might be interfering with VS intellisense? Have you tried resetting your VS settings to the factory default? Jeremy
```
class User
{
public int Id { get; set; }
public string Name { get; set; }
}
class Role
{
public string Name { get; set; }
public IList<string> AllowedOperations { get; set; }
public IList<User> Users { get; set; }
}
```
and validators:
```
class UserValidator : AbstractValidator<User>
{
public UserValidator()
{
RuleFor(x => x.Id)
.NotEmpty();
}
}
class RoleValidator : AbstractValidator<Role>
{
public RoleValidator()
{
// SetCollectionValidator compiles but doesn't show up in IntelliSense
RuleFor(x => x.Users)
.SetCollectionValidator(new UserValidator());
}
}
```
Addition of following extension method to base AbstractValidator would solve this problem:
```
protected IRuleBuilderInitial<Role, IEnumerable<TProperty>> RuleFor<TProperty>(Expression<Func<Role, IEnumerable<TProperty>>> expression)
{
return base.RuleFor<IEnumerable<TProperty>>(expression);
}
```
This behavior can be confusing for inexperienced programmers, on my team I had problem with younger programmer who tried to use RuleForEach instead of RuleFor+SetCollectionValidator because 'it didn't show up in IntelliSense'. Please consider also improving documentation on RuleForEach method.
Comments: Hi I'm afraid I still can't reproduce the problem. I tried opening your solution in a clean install of visual studio (no resharper) and the SetCollectionValidator method appears in intellisense correctly. (Screenshot attached) I'm not quite sure what else to suggest...are you sure that you don't have any plug-ins installed that might be interfering with VS intellisense? Have you tried resetting your VS settings to the factory default? Jeremy