A Comparative Study of Data Annotations and Fluent Validation in .NET


  • Volodymyr Samotyy
  • Ulyana Dzelendzyak
  • Nazar Mashtaler




validation, NET Data Annotations, Fluent Validation, syntax, readability, maintainability, performance, expressive syntax, flexible architecture


This article presents a comparative study of two validation approaches in .NET – Data Annotations and Fluent Validation – analyzing their syntax, functionality, and other factors (such as readability, maintainability, and performance). The study begins by examining the Data Annotations approach, an in-built validation mechanism in the .NET Framework that uses validation attributes to validate model properties. While Data Annotations offers a simple syntax and is well-known to .NET developers, it may not be ideal for more complex validation scenarios and could become verbose and difficult to maintain. The study then introduces the Fluent Validation approach, which utilizes a fluent syntax to define validation rules in a more expressive, readable, and concise manner. With its flexible architecture and fluent API (application programming interface), Fluent Validation provides greater control over the validation process, enabling better maintainability and performance. The study concludes by highlighting the merits and drawbacks of both approaches, noting that the choice of validation approach will depend on the specific requirements of the project at hand.


Cart & Checkout Usability Research, [Online]. Available at: https://baymard.com/research/checkout-usability.

T. Arciuolo, A. Abuzneid, “Simultaneously shop, bag, and checkout (2SBC-Cart): A smart cart for expedited supermarket shopping,” Proceedings of the 2019 International Conference on Computational Science and Computational Intelligence (CSCI), Las Vegas, NV, USA, 05-07 December 2019, pp. 1162-1167. https://doi.org/10.1109/CSCI49370.2019.00219.

ISO 9000:2005(EN) validation, [Online]. Available at: https://www.iso.org/obp/ui/#iso:std:iso:9000:ed-3:v1:en.

R.-C. Liao, “Customers' perspectives on ISO 9001 QMS auditors' personality traits: A preliminary investigation from Taiwan's certificated companies,” Proceedings of the 2014 International Conference on Service Sciences, Wuxi, China, 2-23 May 2014, , pp. 215-219. https://doi.org/10.1109/ICSS.2014.40.

The Current State of Checkout UX – 18 Common Pitfalls & Best Practices, [Online]. Available at: https://baymard.com/blog/current-state-of-checkout-ux.

R. Helmi, A. Lee, Md G. Md Johar, A. Jamal, L.F. Sim, “Quantum checkout: An improved smart cashier-less store checkout counter system with object recognition,” Proceedings of the 2021 IEEE 11th IEEE Symposium on Computer Applications & Industrial Electronics (ISCAIE), Penang, Malaysia, 03-04 April 2021, pp. 151-156. https://doi.org/10.1109/ISCAIE51753.2021.9431839.

L. Wroblewski, Inline Validation in Web Forms, September 01, 2009, [Online]. Available at: https://alistapart.com/article/inline-validation-in-web-forms/.

S. Yadav, S. Shukla, “Analysis of k-fold cross-validation over hold-out validation on colossal datasets for quality classification,” Proceedings of the 2016 IEEE 6th International Conference on Advanced Computing (IACC), Bhimavaram, India, 27-28 February 2016, pp. 78-83. https://doi.org/10.1109/IACC.2016.25.

M. J. Price, C# 9 and .NET 5 – Modern Cross-Platform Development: Build intelligent apps, websites, and services with Blazor, ASP.NET Core, and Entity Framework Core using Visual Studio Code, 5th ed., Packt Publishing, 2020; pp. 558–563.

C. Rippon, ASP.NET Core 5 and React: Full-stack web development using .NET 5, React 17, and TypeScript 4, Packt Publishing, 2021.

S. Resca, Hands-On RESTful Web Services with ASP.NET Core 3, 1st ed, Packt Publishing, 2019, pp. 90–99.

D. Damyanov, Z. Varbanov, S. Varbanova, “An improved approach of using data storage services in ASP.NET Core,” Proceedings of the 2022 International Conference Automatics and Informatics (ICAI), Varna, Bulgaria, 06-08 October 2022, pp. 287-291. https://doi.org/10.1109/ICAI55857.2022.9959991.

M. Fowler, Fluent Interface, December 20, 2005, [Online]. Available at: https://martinfowler.com/bliki/FluentInterface.html.

Q. Li, C. Jiao, C. Yang, Z. Zhang, L. Yang, “A feasible method of virtual flow field simulation – Part I: An interface from fluent to RTT,” Proceedings of the 2018 5th International Conference on Information Science and Control Engineering (ICISCE), Zhengzhou, China, 20-22 July 2018, pp. 25-29. https://doi.org/10.1109/ICISCE.2018.00015.

M. Fowler, Domain-Specific Languages, 1st ed., Addison-Wesley, 2010, pp. 27–87.

T. R. Silva, “Towards a domain-specific language for behaviour-driven development,” Proceedings of the 2023 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC), 03-06 October 2023, pp. 283-286. https://doi.org/10.1109/VL-HCC57772.2023.00054.

K. Chowdhury, Mastering Visual Studio 2019, 2nd ed., Packt Publishing, 2019, pp. 222–244.

H. Taniguchi, K. Nakasho, “Visual Studio code extension and auto-completion for Mizar language,” Proceedings of the 2021 Ninth International Symposium on Computing and Networking (CANDAR), Matsue, Japan, 23-26 November 2021, pp. 182-188. https://doi.org/10.1109/CANDAR53791.2021.00033.

FluentValidation, [Online]. Available at: https://docs.fluentvalidation.net/en/latest/index.html.

R. Chatley, S. Uchitel, J. Kramer, J. Magee, “Fluent-based Web animation: exploring goals for requirements validation,” Proceedings of the 27th International Conference on Software Engineering, ICSE, St. Louis, MO, USA, 15-21 May 2005, pp. 674–675. https://doi.org/10.1145/1062455.1062603.

A. Freeman, Pro ASP.NET Core 6: Develop Cloud-Ready Web Applications Using MVC, Blazor, and Razor Pages, 9th ed., Appres, 2022, pp. 847–892. https://doi.org/10.1007/978-1-4842-7957-1_29.

A. Lock, ASP.NET Core in Action, 3rd ed., Manning Publications Co., 2023, pp. 250–261.

M. Choudhari, Fluent Validation – Unit Testing the Validators. November 25, 2022, [Online]. Available at: https://thecodeblogger.com/2022/11/25/fluent-validation-unit-testing-the-validators/.

A. Walker, Unit Test an ASP.NET Custom Validator Part 1. May 19, 2021, [Online]. Available at: https://www.linkedin.com/pulse/unit-test-aspnet-custom-validator-part-1-allan-walker/.

R. Osherove, The Art of Unit Testing, 3rd ed., Manning Publications Co., 2024, pp. 19–123.




How to Cite

Samotyy, V., Dzelendzyak, U., & Mashtaler, N. (2024). A Comparative Study of Data Annotations and Fluent Validation in .NET. International Journal of Computing, 23(1), 72-77. https://doi.org/10.47839/ijc.23.1.3437