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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:09:14+00:00 2026-05-30T12:09:14+00:00

I use an EDMX schema as my context. On a previous project where I

  • 0

I use an EDMX schema as my context. On a previous project where I didn’t use a schema, I could change the entity state like this:

public void SaveProduct(Product product)
{
    if (product.ProductID == 0)
        context.Products.Add(product);
    else
        context.Entry(product).State = EntityState.Modified;
    context.SaveChanges();
}

But in this project, I don’t see .Entry in my intellisense (and it won’t suggest a namespace reference if I just type it in).

I tried to modify an entity ans save it. It worked properly.

So my two questions are:
– Why is .Entry not in my intellisense anymore?
– Do we really need to change the entity state with a persistent Context or can we rely on .Net to do that properly?

  • 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-30T12:09:16+00:00Added an answer on May 30, 2026 at 12:09 pm

    I guess previously you used DbContext API but now you are using ObjectContext API – those are two different ways to use EF and each have its own way to do it. Check if you have this (ObjectContext API):

    context.ObjectStateManager.ChangeObjectState(product, EntityState.Modified);
    

    To your second question – you need to attach entity and set state if you are working with detached scenario (your entity instance is not loaded by the same context instance as it is saved).

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

Sidebar

Related Questions

I use an Entity Framework 4 edmx model that contains two entities having a
I've typically done this using edmx's but this time in order to use cascading
I have an edmx file that reflects 100% my DB schema. Along with this
When you use the update-edmx feature of visual studio. Your EDMX schema is merged
use this website a lot but first time posting. My program creates a number
use Rack::Static, :urls => ['/stylesheets', '/images'], :root => 'public' run proc { |env| [200,
I am trying to use Entity Framework with SQL Server CE 4.0. I installed
I use SQL Server 2008 and Entity framework 4.1 database first approach . Is
It should parse EDMX file and create a moch/fake to use in Unit tests.
I use EF 4.1 with POCO. Entities with edmx are located in a separate

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.