LightSwitch: Table Relationships - by G1

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 773380 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 12/3/2012 11:02:04 PM
Access Restriction Public


1) The data source designer erroneously presumes that a non-nullable foreign key implies that the associated entity must exist. While it may be reasonable to presume so, the constraint shoudl be editable. Presently, and perhaps because I am new to LightSwitch, I now have to jump through hoops to accommodate this conflation over an existing schema I do not want to modify.

2) Self-referencing relationships of the form Table.ParentID (0..1)->(0..*) Table.Id are not being represented well. In particular, the navigation properties should occur in the "must have" and "can have" descriptive clarifications. Presently, it is unnecessarily obtuse.
Sign in to post a comment.
Posted by Dan [MSFT] on 1/24/2013 at 12:22 PM

Thank you for reporting the issue. From the repro it would seem you want to create a (0..1)->(0..*) self-referential relationship. To do so you do not need to create the FK field, instead create the relationship to the same table, change the Multiplicity to "Zero or one" on one end, then name the navigation property as needed. LightSwitch will then create the necessary FK field within the table as nullable. You mention wanting a non-nullable FK, yet non-nullable FKs does in fact enforce a (1)->(*) relationship as a constraint and in the case of self-referential relationships it is not supported since there is no way to insert a record while satisfying that constraint.

I hope this clarifies the use of self-referential relationships.

Dan Leeaphon
Visual Studio LightSwitch
Posted by Microsoft on 12/6/2012 at 2:29 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Macy [MSFT] on 12/3/2012 at 11:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(