Follow the code:
using (var db = new Entities())
{
var t = new MinhaTabela
{
MeuCampo= 10
};
db.Entry(t).State = EntityState.Modified;
db.SaveChanges();
}
Table definition:
CREATE TABLE [dbo].[MinhaTabela] (
[MeuCampo] INT NOT NULL,
CONSTRAINT [PK_MinhaTabela] PRIMARY KEY CLUSTERED ([MeuCampo] ASC)
After the line: db.SaveChanges();
nothing happens and does not change the value.
I can not change the value 9 to 10. What am I doing wrong?