Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:32:56+00:00 2026-06-13T16:32:56+00:00

I am experiencing this exception when trying to define a data member contained within

  • 0

I am experiencing this exception when trying to define a data member contained within another piece of data.

Example:

Container newRecord = this.DataWorkspace.ApplicationData.Containers.AddNew();
newRecord.SubContainer = this.DataWorkspace.ApplicationData.SubContainers.AddNew();

The exception, "Reference properties cannot be set to deleted or discarded entities.", is encountered with the second line.

I don’t understand what entity it’s talking about with regard to it being discarded or deleted, so any help with this issue would be most appreciated.

The code lines are in an interface function defined in LightSwitch, which is called from a Silverlight project, passing data from that project to the LightSwitch project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:32:57+00:00Added an answer on June 13, 2026 at 4:32 pm

    I eventually managed to do this after working out that I needed to be on the ‘Logic’ thread, which I was not. I spent a little while messing around trying to find a this.DataContext but could not (my Silverlight project had this but not the LightSwitch project).

    Eventually though I found out what I needed to do:

    this.Details.Dispatcher.BeginInvoke(() =>
    {
    Container newRecord = this.DataWorkspace.ApplicationData.Containers.AddNew();
    newRecord.SubContainer = this.DataWorkspace.ApplicationData.SubContainers.AddNew();
    newRecord.exampleIntProperty=2;
    newRecord.SubContainer.innerString="Example";
    });
    

    I can then assign data to the properties of newRecord and the properties of the objects it contains (such as the example SubContainer‘s properties), although obviously the new record is not saved until LightSwitch is instructed to save its data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm experiencing some problems while trying to read a binary file in C. This
Some reasons i am experiencing this issue on my website. When the website loads
I am experiencing this problem with Node.js express framework 3.0: https://github.com/visionmedia/express/issues/1187 I've been using
I'm experiencing this problem: I want to add the Google Maps API to my
I don't know why I'm experiencing so much trouble with this, but I would
Couldn't comment on this post, which states the problem I'm experiencing: jQuery remove() on
we are experiencing a few problems with the IDisposable pattern. In this case there
I think I'm experiencing the same as http://groups.google.com/group/android-developers/msg/9d37d64aad0ee357 This is Android 1.5 SDK. I
I am trying to implement the delegate Pattern in Objective-C, however I am experiencing
I'm experiencing some problems with sockets. I'm trying to make a concurrent server to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.