Types of Relationship in LightSwitch 2012

Here we will see how to establish relationships between tables in LightSwitch Applications (Visual C#) in Visual Studio 2012.

The following is the procedure for establishing a relationship between tables.

Step 1

Open the Solution Explorer.

sol exp.jpg

Step 2

In the Solution Explorer, right-click on the Server and choose "Add Table".

Add Table.jpg

Step 3

The table appears.

Employee Table

Employee.jpg

Item Table

Items.jpg

Step 4


Go to the menu bar and click on the "Add Relationship" button.

rel button.jpg

The relationship dialog box appears on the screen.

Empty dialog.jpg

Step 5

There are various types of relationships; they are:

1. One to Many
2. Zero or One to One
3. Many to One


Step 6

Establishing a one to many relationship between tables.

rel1.jpg

The relationship between two tables is as in the following:

rel 2.jpg

Step 7

Establishing a many to one relationship between tables.

rel 3.jpg

The relationship between two tables is as in the following:

rel4.jpg

Step 8

Establishing one to one relationship between tables.

one to one.jpg

The relationship shown between two tables
is not supported in LightSwitch 2012.

not supported.jpg

Step 9

Establishing a zero or one to one relationship between tables.

zero or one.jpg

The relationship between two tables is as in the following:


rel 01.jpg


Similar Articles