Adding a new row in a table which has a reference to another Table by "RefId" and "RefTable" RRS feed

  • Question

  • Hello,

    I have two tables, one called "UseCase" and another called "DiagramCollection".

    For some reason I can´t put them into relationship via LightSwitch relationship. Instead I am using the fields "RefId" and "RefTable" inside DiagramCollection to connect the diagrams to their UseCases. 

    When I select an UseCase in my screen, all referenced diagrams are shown in a Table within the same screen view. For that I use the SelectionChanged method of the UseCase table and everything works fine.

    But when I add a new row in the DiagramCollection table and select another UseCase without saving first. Then LightSwitch shows the new diagram row for the other UseCase, too. This is until I press save and the RefId and the Ref Table are written into the database.

    Is there some workaround to prevend unsaved new added diagrams to be shown for all UseCases which are not referenced to this diagram by RefId and Reftable?

    I hope my Question ist not to imprecise.


    Wednesday, July 15, 2015 2:19 PM

All replies

  • Hi Thomas, 

    You need consider using SaveChanges_Executing method, and display the saved UseCases in the diagram. 

    With regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 21, 2015 8:19 AM