Validation and Business Rules
WHAT YOU WILL LEARN IN THIS CHAPTER
- Understanding the validation architecture of LightSwitch
- Using the Designer to create declarative validation rules
- Writing custom validation code for checking properties and entities
- Implementing business rules and intercepting the save pipeline
In the previous chapters, you built database tables, created simple and master-detail screens, and learned how to use a variety of methods to customize screens. However, you have not yet dealt with the consistency and integrity of data you typed in and saved to the database.
No line-of-business (LOB) application exists without accompanying rules that characterize the business. LightSwitch was designed with validation and business operations in mind. In this chapter, you will learn about the concept of data validation, and about the tools LightSwitch provides to create compound business operations.
NOTE Compound business operations consist of a set of steps to carry out a well-defined and consistent operation. They generally modify a set of related records in a database, generally in the form of an atomic transaction. For example, when you order a book that is not in stock, this operation may also generate a background order to fill up the stock and mark your purchase order to be continued when the book is in stock.
VALIDATION AND BUSINESS LOGIC ARCHITECTURE ...