在我的 wcf 服务中,我有如下操作合同的方法:
public void Update(long id, string docNo, Nullable<int> item, string regNo, string payCode, string fixVar,
string effectiveDate, string calcBase, Nullable<decimal> value, string costCenter, string subAcc,
string docReference, string comment)
{
using (WFS006Entities dbu = new WFS006Entities())
{
NIOCPay_PayDetail doc = dbu.NIOCPay_PayDetail.Where(it => it.ID == id).SingleOrDefault();
if (doc != null)
{
doc.DocNo = docNo;
doc.Item = item.HasValue ? item.Value : 0;
doc.RegNo = regNo;
doc.PayCode = payCode;
doc.FixVar = fixVar;
doc.EffectiveDate = effectiveDate;
doc.CalcBase = calcBase;
doc.Value = value.HasValue ? value.Value : 0;
doc.CostCenter = costCenter;
doc.SubAcc = subAcc;
doc.DocReference = docReference;
doc.Comment = comment;
}
dbu.Entry<NIOCPay_PayDetail>(doc).State = System.Data.EntityState.Modified;
dbu.NIOCPay_PayDetail.Attach(doc);
dbu.SaveChanges();
}
}
文档实体更新和 savechanges 方法运行没有任何错误,但没有在数据库中我也在同时运行 SQL Profiler,我发现没有任何事情发生,没有 sql 或任何执行 sql 命令。我应该怎么做?