Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You can create your own validation rules at the database when working with an external SQL Server database. For example, you could create SQL Server check constraints to validate the data against a T-SQL expression. If a user attempts to enter data that conflicts with the database rules that you have defined, LightSwitch will return the error to the user in the validation result summary.
Earlier in this chapter, we showed you how to prevent users from entering duplicate records. If you were using an attached SQL Server database, you could apply this validation using a SQL Server unique constraint. To create a unique constraint, open your table in SQL Server Management Studio. On the toolbar, click the Index button, and the Indexes/Keys dialog box opens, as shown in Figure 5-8.