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

  • Home
  • SEARCH
  • 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 8246751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:36:33+00:00 2026-06-07T22:36:33+00:00

Again i’ve got a problem with visual studio lightswitch. Now its about custom validation.

  • 0

Again i’ve got a problem with visual studio lightswitch. Now its about custom validation. I’ve got an entity which has a foreign key referring to another entity:
enter image description here

RouteItem contains a foreign key to the FacilityItem which looks like this:

enter image description here

What i now want to do is to validate the ROUTENAME in the RouteItem. I have to make sure that the routname does not already exists in the selected Facility.

My validation code looks like this:

    IEnumerable<RouteItem> items = this.DataWorkspace.dsMESOracle.dtRoutes.GetQuery().Execute();

        if (this.Details.EntityState == EntityState.Added)
        {
            items = items.Where(e => e.ROUTENAME == ROUTENAME && e.MES_FACILITY == MES_FACILITY);
            if (items.Count() > 0)
            {
                results.AddPropertyError(ValidationMsgRes.ROUTES_ROUTENAME_ALREADY_EXISTS);

            }
        }
        else if (this.Details.EntityState == EntityState.Modified)
        {
            //Ignore the current entity if its modified otherwise it will always get count > 0
            items = items.Where(e => e.ROUTENAME == ROUTENAME && e.MES_FACILITY == MES_FACILITY && e != this);
            if (items.Count() > 0)
            {
                results.AddPropertyError(ValidationMsgRes.ROUTES_ROUTENAME_ALREADY_EXISTS);

            }
        }

So far the validation logic works perfect – it does what it should.
The main problem is that accessing the this.MES_FACILITY leads to the following error if lightswitch tries to save / update the changes:

enter image description here

the error also occurs if i ONLY write acilityItem temp = this.MES_FACILITY; in the validation implementation.

If i remove the all references / accesses what ever to this.MES_FACILITY in the validation implementation everything works perfect.

It also doesn’t matter if validation is true or false. The problem always occurs!
PS: The Problem also occurs with other entities and foreign keys its not a problem of the RouteItem – FacilityItem combination

  • 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-07T22:36:36+00:00Added an answer on June 7, 2026 at 10:36 pm

    Found a solution for this error / problem:

    http://msdn.microsoft.com/en-us/library/bb738618.aspx
    http://knowledgebase.progress.com/articles/Article/000028868

    Workaround
    1. Clean whole solution
    2. Search the whole solution / project folder (in Explorer not in VisualStudio or by using Notepad++) for ConcurrencyMode=”Fixed” and remove it
    3. Rebuild solution
    4. Be happy!

    It worked for me 🙂

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

Sidebar

Related Questions

Again I have problem with checking whether DataReader object has data or not? Dim
Again a JasperReports problem - really annoying. Let's say I've got a report with
again have problem with opends now i would like to save unicode in the
Once again I've got a problem with mixed format data in excel file. I've
again i have got a problem with socket programming in Android. My Problem is
Again problem with understanding Java. When I asked previous question about Hello world in
Again in problem Actually I have following jsp code in which I have few
Again, I was creating buttons dynamically based on this post and now I need
Hello again everyone, This time I have a problem with Intent & Extras. here's
Once again a question about extjs. I use EXT 4.0.2 and have a couple

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.