发送其他参数清风节能服务器功能 [英] send additional parameters to breeze-saving-server functions

查看:117
本文介绍了发送其他参数清风节能服务器功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在迪朗达尔项目。 我用风来检索和保存我的数据。 我要发送到服务器,在保存,比其他实体的附加参数,喜欢 - 谁是保存该实体的用户。 但是,微风功能的SaveChanges只接受一个参数 - 实体数组保存。

I work in durandal project. I use breeze to retrieve and save my data. I want to send to the server, on saving, additional parameters other than the entity, like- who is the user that save the entity. but, function saveChanges of breeze accept only one parameter- entities array for saving.

我该怎么办?

推荐答案

您可以使用SaveOptions.tag属性。事情是这样的:

You can use the SaveOptions.tag property. Something like this:

var so = new SaveOptions({ resourceName: "SaveWithComment", tag: "Whatever data you want" });
return myEntityManager.saveChanges(null, so);

标签属性的ContextProvider内的服务器上可用,这样你就可以访问它是这样的:

The 'tag' property is made available on the server within the ContextProvider, so you can access it like this:

// within your server side ContextProvider
protected override bool BeforeSaveEntity(EntityInfo entityInfo) {
   var tag = (string)SaveOptions.Tag;
   ...

}

这篇关于发送其他参数清风节能服务器功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆