Entity framework 通过Breeze.js保存新实体在AutoGeneratedKey上出错

Entity framework 通过Breeze.js保存新实体在AutoGeneratedKey上出错,entity-framework,asp.net-web-api,breeze,Entity Framework,Asp.net Web Api,Breeze,通过Breeze、WebAPI和entity Framework将实体保存到数据库时出错。我在我的breeze客户端进行了检查,创建了新实体。在我的WebAPI控制器SaveChanges方法中,我检查了saveBundle作业对象,它看起来也正常 我得到的错误是: An exception of type 'System.MissingFieldException' occurred in Breeze.ContextProvider.dll but was not handled in us

通过Breeze、WebAPI和entity Framework将实体保存到数据库时出错。我在我的breeze客户端进行了检查,创建了新实体。在我的WebAPI控制器SaveChanges方法中,我检查了saveBundle作业对象,它看起来也正常

我得到的错误是:

An exception of type 'System.MissingFieldException' occurred in Breeze.ContextProvider.dll but was not handled in user code`

Additional information: Field not found: 'Breeze.ContextProvider.EntityInfo.AutoGeneratedKey'.`



   at Breeze.ContextProvider.EF6.EFContextProvider`1.SaveChangesCore(SaveWorkState saveWorkState)
   at Breeze.ContextProvider.ContextProvider.OpenAndSave(SaveWorkState saveWorkState)
   at Breeze.ContextProvider.ContextProvider.SaveChanges(JObject saveBundle, TransactionSettings transactionSettings)
   at FCMA.BusinessFunctions.DataAccess.BusinessFunctionsRepository.SaveChanges(JObject saveBundle) in c:\_tfs\AppDev\Intranet\BusinessFunctions\dev\src\BusinessFunctions.DataAccess\BusinessFunctionsRepository.cs:line 22
   at CC.Web.Controllers.BreezeController.SaveChanges(JObject saveBundle) in c:\_tfs\AppDev\Intranet\BusinessFunctions\dev\src\BusinessFunctions\Controllers\BreezeController.cs:line 28
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)

我哪里做错了?任何帮助都将不胜感激。谢谢。

事实证明,我需要一个更新版本的Breeze.Server.ContextProvider.EF6用于我的数据访问项目,如Nico Leguizamon在其对链接上类似问题的回答中指出的: 谢谢你,尼科

 ?   saveBundle
    {
      "entities": [
        {
          "Id": -1,
          "CpuCode": 469,
          "ActionCode": 1,
          "ApplicationTypeCode": 1,
          "Cif": 12121,
          "CustomerName": null,
          "SalesBranch": null,
          "StatusCode": 1,
          "FsoCode": "asd",
          "BaCode": "asd",
          "LpsCode": null,
          "Transfer": false,
          "LoanNbr": null,
          "LoanAmount": 123,
          "DatePackageRcvd": null,
          "DateDecision": null,
          "Comments": null,
          "CreatedBy": null,
          "DateTimeCreated": null,
          "UpdatedBy": null,
          "DateTimeUpdated": "2014-01-02T21:07:56.52Z",
          "entityAspect": {
            "entityTypeName": "Log:#FCMA.BusinessFunctions.Model",
            "defaultResourceName": "Logs",
            "entityState": "Added",
            "originalValuesMap": {},
            "autoGeneratedKey": {
              "propertyName": "Id",
              "autoGeneratedKeyType": "Identity"
            }
          }
        }
      ],
      "saveOptions": {}
    }
        base: {
      "entities": [
        {
          "Id": -1,
          "CpuCode": 469,
          "ActionCode": 1,
          "ApplicationTypeCode": 1,
          "Cif": 12121,
          "CustomerName": null,
          "SalesBranch": null,
          "StatusCode": 1,
          "FsoCode": "asd",
          "BaCode": "asd",
          "LpsCode": null,
          "Transfer": false,
          "LoanNbr": null,
          "LoanAmount": 123,
          "DatePackageRcvd": null,
          "DateDecision": null,
          "Comments": null,
          "CreatedBy": null,
          "DateTimeCreated": null,
          "UpdatedBy": null,
          "DateTimeUpdated": "2014-01-02T21:07:56.52Z",
          "entityAspect": {
            "entityTypeName": "Log:#FCMA.BusinessFunctions.Model",
            "defaultResourceName": "Logs",
            "entityState": "Added",
            "originalValuesMap": {},
            "autoGeneratedKey": {
              "propertyName": "Id",
              "autoGeneratedKeyType": "Identity"
            }
          }
        }
      ],
      "saveOptions": {}
    }
        Type: Object