Prologue:My previous article was about how to pass parameters into screens in a LightSwitch application. Here we shall discuss how to make reference tables i.e. how to make a relationship among LightSwitch internal tables.What is Data Relationship in LightSwitch Beta 2?A relationship among Data helps you to create screens in which the related data work together.For example, a screen that shows both Employees and their Projects. We can create, modify, or delete relationships between data by using the data designer in LightSwitch. Multiplicity Settings in Relationship:Multiplicity settings are used to specify how you want these tables to be related.
Entity one
Entity two
Description
One
Zero or one
An "Entity one" can have one or no "Entity two", but an "Entity two" must have an "Entity one".
Many
An "Entity one" can have many "Entity two" instances, but an "Entity two" must have an "Entity one".
An "Entity one" must have an "Entity two", but an "Entity two" can have one or no "Entity one".
An "Entity one" can have many "Entity two" instances, and an "Entity two" can have one or no "Entity one".
An "Entity one" must have an "Entity two", but an "Entity two" can have many "Entity one" instances.
An "Entity one" can have one or no "Entity two", and an "Entity two" can have many "Entity one" instances.
On Delete Behaviour Value
Cascade delete
When a "Table1" is deleted, delete all related "Table2" instances.
Restricted
"Table1" cannot be deleted if there are related "Table2" instances.
For example, select Restricted to specify that a customer cannot be deleted if there are related orders in the database.