Breeze 为什么EFContextProvider 1.4.16在尝试更新枚举值时抛出DbUpdateConcurrencyException?

Breeze 为什么EFContextProvider 1.4.16在尝试更新枚举值时抛出DbUpdateConcurrencyException?,breeze,Breeze,我试图保存一个更改-枚举属性值更新。在服务器上调用了EFContextProvider.SaveChanges,但生成的SQL错误,由EFContextProvider执行时会抛出System.Data.Entity.Infrastructure.DbUpdateConcurrencyException 枚举属性的定义如下: public virtual System.Nullable<StanZleceniaOplaty> Stan { get; set; }

我试图保存一个更改-枚举属性值更新。在服务器上调用了EFContextProvider.SaveChanges,但生成的SQL错误,由EFContextProvider执行时会抛出System.Data.Entity.Infrastructure.DbUpdateConcurrencyException

枚举属性的定义如下:

        public virtual System.Nullable<StanZleceniaOplaty> Stan { get; set; }

        public enum StanZleceniaOplaty : int
        {
                    Created,
                    Started,
                    Canceled,
                    Rejected,
                    Paid
        }
请注意,此枚举属性是ConcurrencyToken

我正在将枚举从已创建更改为已取消,并调用SaveChanges。 我可以看到EFContextProvider在EF 6.1 DB中生成的SQL是错误的[Stan]没有更改,因为@0==@2,@2有错误的值-应该是0

exec sp_executesql N'UPDATE [dbo].[ZlecenieOplaty]
SET [Stan] = @0
WHERE (([Id] = @1) AND ([Stan] = @2))
SELECT [NrZlecenia]
FROM [dbo].[ZlecenieOplaty]
WHERE @@ROWCOUNT > 0 AND [Id] = @1',
N'@0 int,@1 int,@2 int',
@0=2,
@1=3,
@2=2
实际上,将引发以下异常

System.Data.Entity.Infrastructure.DbUpdateConcurrencyException occurred
  HResult=-2146233087
  Message=Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
  Source=EntityFramework
  StackTrace:
       at System.Data.Entity.Internal.InternalContext.SaveChanges()
       at Alcance.Entities.AlcanceDbContext.SaveChanges() in d:\Develop\alcance\src\dev\Alcance.Data\Model\AlcanceModel.AlcanceDbContext.Connection.cs:line 121
  InnerException: System.Data.Entity.Core.OptimisticConcurrencyException
       HResult=-2146233087
       Message=Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
       Source=EntityFramework
       StackTrace:
            at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ValidateRowsAffected(Int64 rowsAffected, UpdateCommand source)
            at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
            at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
            at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
            at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation)
            at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
            at System.Data.Entity.Internal.InternalContext.SaveChanges()
       InnerException:
我打开了


有人能确认这是一个bug吗?

我建议也将相关代码放在这里,以便有人能很容易地看到某个地方是否有问题。我用更多的细节和代码更新了我的问题。只是为了确保我理解。是否将枚举属性用作并发列?如果是,原因是什么???。并发列的概念是处理乐观并发冲突,在这种情况下使用枚举值似乎是错误的。此列表示实体的状态。我知道,通常使用RowVersion,但在这个特殊情况下,我只对状态更改引起的并发冲突感兴趣。我可能决定稍后切换到RowVersion。
System.Data.Entity.Infrastructure.DbUpdateConcurrencyException occurred
  HResult=-2146233087
  Message=Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
  Source=EntityFramework
  StackTrace:
       at System.Data.Entity.Internal.InternalContext.SaveChanges()
       at Alcance.Entities.AlcanceDbContext.SaveChanges() in d:\Develop\alcance\src\dev\Alcance.Data\Model\AlcanceModel.AlcanceDbContext.Connection.cs:line 121
  InnerException: System.Data.Entity.Core.OptimisticConcurrencyException
       HResult=-2146233087
       Message=Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
       Source=EntityFramework
       StackTrace:
            at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ValidateRowsAffected(Int64 rowsAffected, UpdateCommand source)
            at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
            at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
            at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
            at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation)
            at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
            at System.Data.Entity.Internal.InternalContext.SaveChanges()
       InnerException: