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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:18:20+00:00 2026-05-23T06:18:20+00:00

I am using EISK (Employee Info Starter Kit) to develop an application. My entity

  • 0

I am using EISK (Employee Info Starter Kit) to develop an application. My entity diagram looks like this Entity Diagram I try to update the application table via this code.

           int apId = Convert.ToInt32(Request.QueryString["ApplicationID"]);

            ApplicationBLL objGetApplication = new ApplicationBLL();

            Appdec.YEP.BusinessEntities.Application objApplication =
            objGetApplication.GetApplicationByApplicationID(apId);



            objApplication.Status = (ddlStatus.SelectedValue == "0" ? false : true);



            new ApplicationBLL(new Appdec.YEP.DataAccessLayer.DatabaseContext()).UpdateApplication(objApplication);

now the update method at bussiness logic is

 [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
    public void UpdateApplication(Application updatedApplication)
    {
        // Validate Parameters
        if (updatedApplication == null)
            throw (new ArgumentNullException("updatedApplication"));

        // Validate Primary key value
        if (updatedApplication.ApplicationID.IsInvalidKey())
            BusinessLayerHelper.ThrowErrorForInvalidDataKey("ApplicationID");

        // Apply business rules
        OnApplicationSaving(updatedApplication);
        OnApplicationUpdating(updatedApplication);

        //attaching and making ready for parsistance
        if (updatedApplication.EntityState == EntityState.Detached)
            _DatabaseContext.Applications.Attach(updatedApplication);



_DatabaseContext.ObjectStateManager.ChangeObjectState(updatedApplication, System.Data.EntityState.Modified);//this line throws the error 
//ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type
        int numberOfAffectedRows = _DatabaseContext.SaveChanges();
        if (numberOfAffectedRows == 0) 
            throw new DataNotUpdatedException("No application updated!");

        //Apply business workflow
        OnApplicationUpdated(updatedApplication);
        OnApplicationSaved(updatedApplication);

    }

Can somebody tell me how to fix this error and update the tables.
the same error ocurres when i try to update other tables also. The insert works fine.
Hoping not to bother you. Best Regards.

  • 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-23T06:18:21+00:00Added an answer on May 23, 2026 at 6:18 am

    So it already belongs to a context,and you should update that context.
    It can’t be attached to new context,
    You can create a new instance of updatedApplication and copy all properties of updatedApplication to this new one and attach new entity to application.

    Also change

      if (newApp .EntityState == EntityState.Detached)
                _DatabaseContext.Applications.Attach(newApp );
    

    to

    var newApp = Application ();
     //Copy all propery of updatedApplication to  newApp here 
    
                if (newApp .EntityKey == null || newApp .EntityKey.IsTemporary)
                {
                    _DatabaseContext.Applications.AddObject(newApp );
                }
                else
                {
                    _DatabaseContext.Applications.Attach(newApp );
                }
    _DatabaseContext.ObjectStateManager.ChangeObjectState(newApp , System.Data.EntityState.Modified);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the RichTextArea in GWT, It looks like I can only change the font
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using NSDateComponents I know how to get the day component, but this gives me
Using Entity Framework CodeFirst, how do I create a created datetime column that gets
using file_get_contents , I open an Internet URL and get the contents of this
Using CRM 4, I have an entity form that contains a tab with an
using the jquery ui modal dialog , the background shades grey (i assuming this
Using Ivy with this Ant target: <target name=retrieve-jars> <ivy:retrieve pattern=WebContent/WEB-INF/lib/[artifact].[ext] /> </target> to fetch

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.