1

I have following line of code for Data Annotation validation on PublishedDateTime field, but i would like validate through FluentValidation API

public Instant Published { get; set; }

[Obsolete("EF-serialization purposes")]
[DataType(DataType.DateTime)]         
[EditorBrowsable(EditorBrowsableState.Never)] 
public DateTime PublishedDateTime
{
  get => Published.ToDateTimeUtc();           
  set => Published = DateTime.SpecifyKind(value, DateTimeKind.Utc).ToInstant();
}

How would I convert it to FluentValidation?

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
Urgen
  • 1,095
  • 3
  • 19
  • 39
  • 1
    Could you show how you would write the validation if you weren't using Noda Time? I'm very familiar with Noda Time (as the main author) but not at all familiar with FluentValidation - I suspect other folks are in the exact opposite situation. The more context you can provide, the more we'll be able to help with only partial knowledge of the complete stack. – Jon Skeet Nov 06 '18 at 19:50
  • Ping for more details here? At the moment, the question isn't clear enough to answer, IMO. – Jon Skeet Dec 18 '18 at 12:15

0 Answers0