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 5974045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:53:15+00:00 2026-05-22T20:53:15+00:00

In the following example using (var context = new MyEntities() { // Delete old

  • 0

In the following example

using (var context = new MyEntities() 
{       
   // Delete old data.
   foreach (var data obsoleteData)
   {
     context.DeleteObject(data);
   }

   // Create new data.
   var data = new DataEntity();

   // Initialize data
   // ...

   var id = FoundItem();
   var items = new List<MyItems>();
   foreach (var n in context.Sources)
   {
     var subItems = (from i in context.Entities1 
                     from g in i.Entity1Relations 
                     where g.Type == 0 && g.Id == id 
                     select i).ToList();

     Contract.Assert((from i in subItems 
             where i.SomeCount == 0 select i).FirstOrDefault() == null);
     items.add(FindSource(n, subItems);
   }

   foreach(var i1 in items)
   {
     data.SubItems.Add(i1);
   }

   context.SaveChanges();
}

This asserts sometimes, but the database SomeCount is always > 0!

The Entity1Relations is a table that resolves m : n.

I assume that the entity framework doesn’t queries the database everytime.

Is a solution for this problem available?

  • 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-05-22T20:53:16+00:00Added an answer on May 22, 2026 at 8:53 pm

    I have found an error in FindSource that modified SomeCount Property of other objects. So it has nothing to do with EF.

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

Sidebar

Related Questions

I'm using LINQ-to-Entities. Using the following query: var x = from u in context.Users
I have tried using the obvious method as outlined in the following example but
I was trying the following example, but with external URLs: Using WebViews The example
I am using the following html page: <html> <head> <title>AJAX Example</title> <meta http-equiv=Content-Type content=text/html;
When you execute following example using Firefox 3: <html> <head> <script language=javascript type=text/javascript> <!--
The following example is one way in JavaScript to create and manipulate objects, i.e.
In the following example I get title from this form using html id=title .
Given the URL (single line): http://test.example.com/dir/subdir/file.html How can I extract the following parts using
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)
Given the following example, why do I have to explicitly use the statement b->A::DoSomething()

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.