RIA自定义更新方法
给定我的 RIA 服务:
[Update]
public void Update(Car car)
{
_carRepository.Update(car);
}
[Update(UsingCustomMethod = true)]
public void UpdateAndClone(Car car)
{
_carRepository.UpdateAndClone(car);
}
如何从 Silverlight 客户端将 SubmitChanges“映射”到我的自定义更新方法?
Public void Save(Action<SubmitOperation> submitCallback, object state)
{
_carContext.SubmitChanges(submitCallback, state);
}
Public void SaveAndClone(Action<SubmitOperation> submitCallback, object state)
{
_carContext.SubmitChanges(submitCallback, state);
// _carContext.UpdateAndClone(????)
}
我希望我的应用程序根据用户执行的操作以两种完全不同的方式处理更新,但我很难理解应该如何使用我的“自定义”更新。
Given my RIA Service:
[Update]
public void Update(Car car)
{
_carRepository.Update(car);
}
[Update(UsingCustomMethod = true)]
public void UpdateAndClone(Car car)
{
_carRepository.UpdateAndClone(car);
}
How may I "map" SubmitChanges to my Custom update method from my Silverlight client side?
Public void Save(Action<SubmitOperation> submitCallback, object state)
{
_carContext.SubmitChanges(submitCallback, state);
}
Public void SaveAndClone(Action<SubmitOperation> submitCallback, object state)
{
_carContext.SubmitChanges(submitCallback, state);
// _carContext.UpdateAndClone(????)
}
I would like my application to handle the update in two quite different ways according to which action is peformed by the user, but I'm having trouble to understand how my "custom" update should be used.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来我不能同时拥有“标准”更新和自定义更新。
因此,通过在执行 .SubmitChanges() 之前调用视图模型中的自定义方法可以解决此问题。
It seems that I can't have both a "standard" update and a custom update.
So by calling the custom method in the viewmodel before doing .SubmitChanges() solves this issue.