locked
Troubles with update User Entity data RRS feed

  • General discussion

  • Hello, friends. I have a business application with database with table Users (which one has KEY column "ID" (with auto_increment) and some other columns).

    So my problem is next: when I try to update some User entity information (example - Name/Password/Roles), the application sends to database full User entity (with thе "ID" field) and, of course, tries to refresh it. As this column is auto_increment key, it's cannot be rewrited. Only added or deleted. So becouse of that, my application gets exception about unable to change column "ID" (as I said).

    P.S. Add new or Delete old records do not cause any exception.

            [RequiresAuthentication]
            public void UpdateUser(User currentUser)
            {
                this.ObjectContext.Users.AttachAsModified(currentUser, this.ChangeSet.GetOriginal(currentUser));
                //Something needs to change there...
            }

    Can anybody help me with this?

    Wednesday, October 24, 2012 10:48 AM