Click here to Skip to main content
15,913,669 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Song of the Week Pin
908236519-Feb-16 4:19
908236519-Feb-16 4:19 
GeneralRe: Song of the Week Pin
Sander Rossel19-Feb-16 7:59
professionalSander Rossel19-Feb-16 7:59 
GeneralRe: Song of the Week Pin
908236519-Feb-16 4:14
908236519-Feb-16 4:14 
GeneralMQOTD Pin
V.18-Feb-16 21:21
professionalV.18-Feb-16 21:21 
GeneralRe: MQOTD Pin
Herman<T>.Instance18-Feb-16 21:29
Herman<T>.Instance18-Feb-16 21:29 
GeneralRe: MQOTD Pin
HobbyProggy18-Feb-16 21:50
professionalHobbyProggy18-Feb-16 21:50 
GeneralRe: MQOTD Pin
Brittle161818-Feb-16 22:49
Brittle161818-Feb-16 22:49 
Generalnot quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project PinPopular
BillWoodruff18-Feb-16 11:43
professionalBillWoodruff18-Feb-16 11:43 
By accident, while researching a problem using a custom Attribute with 'AllowMultiple = true ... I stumbled across a link to Jeremy's project on GitHub (Apache License 2.0): [^], and I found his work very impressive.

I really like the fluent semantics and chaining he's implemented; here's an example what a Validator for a POCO class, Customer, looks like: (from the GitHub site)
C#
using FluentValidation;

public class CustomerValidator: AbstractValidator<Customer> {
  public CustomerValidator() {
    RuleFor(customer => customer.Surname).NotEmpty();
    RuleFor(customer => customer.Forename).NotEmpty().WithMessage("Please specify a first name");
    RuleFor(customer => customer.Discount).NotEqual(0).When(customer => customer.HasDiscount);
    RuleFor(customer => customer.Address).Length(20, 250);
    RuleFor(customer => customer.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode");
  }

  private bool BeAValidPostcode(string postcode) {
    // custom postcode validating logic goes here
  }
}
It took me only a few minutes to rig-up a test Project ... using NuGet to install FluentValidation ... in Visual Studio, and get it working.

He's got both global and local (over-rideable) settings for whether all validation tests run to completion, or whether validation terminates if any one test fails.

The fluent style used in the code resonated in my head with some of Marc Clifton's interesting articles here.

I sent Jeremy an e-mail and told him I thought a lot of people would be interested in the architecture of this project, the problems solved, the design decision, and mentioned CodeProject Smile | :)

I like the smell of good software !
«In art as in science there is no delight without the detail ... Let me repeat that unless these are thoroughly understood and remembered, all “general ideas” (so easily acquired, so profitably resold) must necessarily remain but worn passports allowing their bearers short cuts from one area of ignorance to another.» Vladimir Nabokov, commentary on translation of “Eugene Onegin.”

GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
Kevin Marois18-Feb-16 11:46
professionalKevin Marois18-Feb-16 11:46 
GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
Marc Clifton18-Feb-16 12:26
mvaMarc Clifton18-Feb-16 12:26 
GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
BillWoodruff18-Feb-16 18:37
professionalBillWoodruff18-Feb-16 18:37 
GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
Marc Clifton20-Feb-16 8:13
mvaMarc Clifton20-Feb-16 8:13 
GeneralI'm as mad as hell and I'm not going to take this anymore! PinPopular
GuyThiebaut18-Feb-16 8:13
professionalGuyThiebaut18-Feb-16 8:13 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Manfred Rudolf Bihy18-Feb-16 8:25
professionalManfred Rudolf Bihy18-Feb-16 8:25 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut18-Feb-16 8:31
professionalGuyThiebaut18-Feb-16 8:31 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Manfred Rudolf Bihy18-Feb-16 8:43
professionalManfred Rudolf Bihy18-Feb-16 8:43 
PraiseRe: I'm as mad as hell and I'm not going to take this anymore! PinPopular
Duncan Edwards Jones18-Feb-16 8:26
professionalDuncan Edwards Jones18-Feb-16 8:26 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Cornelius Henning18-Feb-16 8:37
professionalCornelius Henning18-Feb-16 8:37 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut18-Feb-16 8:43
professionalGuyThiebaut18-Feb-16 8:43 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Cornelius Henning18-Feb-16 8:57
professionalCornelius Henning18-Feb-16 8:57 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
BillWoodruff18-Feb-16 11:26
professionalBillWoodruff18-Feb-16 11:26 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut19-Feb-16 6:49
professionalGuyThiebaut19-Feb-16 6:49 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
JHizzle18-Feb-16 21:58
JHizzle18-Feb-16 21:58 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut19-Feb-16 0:38
professionalGuyThiebaut19-Feb-16 0:38 
GeneralDo You Think ASP.NET has a Future? Pin
User 1218466518-Feb-16 8:00
User 1218466518-Feb-16 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.