C# 未使用WCF将值更新到EF 4.1的数据库

C# 未使用WCF将值更新到EF 4.1的数据库,c#,wcf-data-services,C#,Wcf Data Services,我已经做了这行代码,但是值没有得到更新。我使用了rad控件 db.MergeOption = MergeOption.OverwriteChanges; var c1 = (from c in db.Currency where c.ThreeLetterIsoCode == "1" select c).First(); c1.ThreeLetterIsoCode = "Updatesd"; db.UpdateObject(c1); db.SaveChanges(); radDataServic

我已经做了这行代码,但是值没有得到更新。我使用了rad控件

db.MergeOption = MergeOption.OverwriteChanges;
var c1 = (from c in db.Currency where c.ThreeLetterIsoCode == "1" select c).First();
c1.ThreeLetterIsoCode = "Updatesd";
db.UpdateObject(c1);
db.SaveChanges();
radDataServiceDataSource1.SubmitChanges();
没有例外,但它不会得到更新

这项服务是:

public static void InitializeService(DataServiceConfiguration config)
{
  // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
  // Examples:
  // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);                 
  // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
  config.SetEntitySetAccessRule("*", EntitySetRights.All);
  config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}

protected override ObjectContext CreateDataSource()
{
  BaazaarDbContext nw = new BaazaarDbContext();

  // Configure DbContext before we provide it to the
  // data services runtime.
  nw.Configuration.ValidateOnSaveEnabled = false;

  // Get the underlying ObjectContext for the DbContext.
  var context = ((IObjectContextAdapter)nw).ObjectContext;

  // Return the underlying context.
  return context;
}

我已经插入了一行,它将被插入。请对此提供帮助。

如果ThreeLetterIsoCode是一个关键属性,那么这是设计的。不能更改现有实体的键属性,因为这将更改OData中不支持的实体标识。
如果ThreeLetterIsoCode是正常属性,则上述属性应起作用。在这种情况下,您能抓取请求/响应的跟踪信息(例如使用Fiddler)并将其发布到这里吗?

是的,绝对正确。我重复犯了同样的错误,然后突然发现我尝试更新代码的[key]属性。当我对另一个非key属性执行相同操作时,它成功了。谢谢。