Debug&Run
  • Home
  • About

Tuesday, 7 January 2020

Validate Model out side of the controller





var vc = new ValidationContext(myObject, null, null);
return Validator.TryValidateObject(myObject, vc, null, true);

Source: https://stackoverflow.com/questions/3782678/how-can-i-use-the-data-validation-attributes-in-c-sharp-in-a-non-asp-net-context

Posted by Sravan Kumar at 21:07
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2023 (1)
    • ►  July (1)
  • ►  2021 (4)
    • ►  November (1)
    • ►  March (3)
  • ▼  2020 (3)
    • ►  February (1)
    • ▼  January (2)
      • Stop Automatic model state validation in mvc or we...
      • Validate Model out side of the controller
  • ►  2019 (4)
    • ►  October (2)
    • ►  September (1)
    • ►  July (1)
  • ►  2018 (9)
    • ►  December (1)
    • ►  October (2)
    • ►  April (1)
    • ►  February (1)
    • ►  January (4)
  • ►  2016 (5)
    • ►  August (5)

About Me

Sravan Kumar
View my complete profile
krithikcreations. Awesome Inc. theme. Powered by Blogger.