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

Commented Unassigned: "'RuleFor' is not supported by the language" in Silverlight application [7181]

$
0
0
When I use portable library in Silverlight 4 application, I get this error: "'RuleFor' is not supported by the language".

Here is code snippet:
{{
namespace FluentValidationCheck
{
public partial class MainPage : UserControl
{
public string Title { get; set; }

public MainPage()
{
InitializeComponent();

Title = "hello world";

var validator = new MainPageValidator();
ValidationResult result = validator.Validate(this);

if (!result.IsValid)
{
IList<ValidationFailure> failures = result.Errors;
MessageBox.Show(failures[0].ErrorMessage);
}
}
}

public class MainPageValidator : AbstractValidator<MainPage>
{
public MainPageValidator()
{
RuleFor(page => page.Title).Length(1, 5).WithMessage("Title must be less then 5 symbols");
}
}
}
}}

Compilation error occurs in this line
{{ RuleFor(page => page.Title).Length(1, 5).WithMessage("Title must be less then 5 symbols"); }}

Example solution can be dowloaded here: http://yadi.sk/d/ivGAMuxNQP7TH
Comments: Thank you for fast response, Jeremy. It's very sorrowfully that SL4 doesn't support :( It's very great library, thank you for your work!

Viewing all articles
Browse latest Browse all 1917

Trending Articles