我可以使用更新存储过程来保存具有 breeze 的视图吗?

Can I use an update stored procedure to save a view with breeze?

我有一个视图,其中有一个字段是可编辑的。

我的想法是创建一个更新查询并将其映射到该视图,但是 breeze 在我调用 SaveChanges 时抛出错误。

** 错误 **

TypeError: Cannot read property 'map' of undefined
at i._prepareSaveResult (breeze.min.js:formatted:5066)
at Object.it.AbstractDataServiceAdapter.i.saveChanges.n.ajax.success (breeze.min.js:formatted:4755)
at n (breeze.min.js:formatted:4818)
at angular.js:9408
at processQueue (angular.js:13248)
at angular.js:13264
at Scope.$get.Scope.$eval (angular.js:14466)
at Scope.$get.Scope.$digest (angular.js:14282)
at Scope.$get.Scope.$apply (angular.js:14571)
at done (angular.js:9698)

编辑

我的视图映射到一个实体

public partial class Shop
{
    public Shop()
    {
        this.Notes = new HashSet<SoNote>();
    }

    public int SoId { get; set; }
    public int DetailId { get; set; }
    //[other properties removed for brevity]
    public string ShopTech { get; set; }

    public virtual OrderEdit OrderEdit { get; set; }
    public virtual ICollection<SoNote> Notes { get; set; }
}

}

SoId 和 DetailId 是我的密钥,我希望用户能够更新 ShopTech。

这是先使用模型。

我不确定这个错误是真正的根本原因。您的视图是如何定义的以及您使用的是哪种数据库?就更新视图而言,数据库存在限制。在大多数情况下,视图是只读的,针对它的 SQL 更新语句将失败。某些类型的视图是可编辑的。对于其他情况,EntityFramework 6 允许您定义insert/update/delete 存储过程。您是否定义了更新存储过程?只要 EF 能够更新您的实体,Breeze 就应该没问题。

这里有更多关于使用代码优先存储过程的信息。 https://msdn.microsoft.com/en-us/data/dn468673.aspx