Software-Entwicklung, Projektleitung, Web-Design
Kontakt:   +41 61 927 18 30
You are here:

Blog

Missing relationships in Lightswitch and/or Entity Framework

by Joerg Lang | Nov 06, 2012

Recently I was struggling with a problem that was a real tough cookie.

I was using Lightswitch to create a few simple data entry screens, but when picking the tables from the SQL Server database, no relations were imported. I double checked that the relations do exist in SQL Server and they did. Then I tried to add the same tables to an Entity Framework data context with the same result. Tables got imported, but relations were missing.

After a lot of try and error I finally found the reason for this behaviour. I had (or better the tool I use for data modeling) has created an additional index on the primary key column. After removing that second (not required) index from the primary key column, Entity Framework and Lightswitch picked up the relations. Hooray...