In this article, we are going to see how we can validate a data field by applying some validation rules in a Visual Studio Light Switch application. In our earlier article, we have seen how to handle the data with the different source provider options that are available with the Visual Studio Light Switch application in 2012 version. Light Switch application generates its own code base with the schema of the data and the relation while designing the tables. But with the front end screens which will be generated by itself in design time, we need to provide our own validation mechanism that best suits the business requirement for the specific field. [more]
Light Switch validation can be done in three different ways as suggested by Microsoft which is of Entity validation, Screen validation and Data Service validation. Entity validation rules will validate each and every entity along with the properties that can be specified with the entity. Screen Validation rules will validate the screen properties and the data that are associated with the specific screen. Data Service Validation rules will validate the service and the data before storing the details to the storage medium. Let us see the steps on how to achieve this task in real time by providing a different validation rule for different fields in the application.