Silverlight 错误 263 域操作条目'MyOperation'必须恰好采用一个参数
我有一个使用 RIA 服务的 Silverlight 应用程序。但是,我需要一个带有多个参数的服务操作。我的操作如下所示:
public void MyOperation(string userName, bool isActive, string emailAddress)
{
// Do Stuff
}
就目前而言,我收到一条错误消息: 错误 263 域操作条目“MyOperation”必须仅采用一个参数。
我的问题是,如何在 RIA Services 服务中创建采用多个参数的服务操作?谢谢!
I have a Silverlight application that is using RIA Services. However, I need a service operation that takes multiple parameters. My operation looks like the following:
public void MyOperation(string userName, bool isActive, string emailAddress)
{
// Do Stuff
}
As it stands now, I get an error that says:
Error 263 Domain operation entry 'MyOperation' must take exactly one parameter.
My question is, how do I create a service operation tht takes multiple parameters in a RIA Services service? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您提供的代码对我有用(按原样)。但是,如果您的操作名称实际上不是
MyOperation
,而是类似InsertOperation
或AddOperation
或属于以下类型的名称,则会出现错误“CRUD”(创建读取更新删除操作)。这是 RIA 服务中的一些约定的原因(您可以阅读有关 此处)。要解决此问题,您可以使用不符合这些约定的名称,也可以使用
InvokeAttribute
将操作指定为调用操作,例如所以:希望这有帮助:)
The code that you provided works for me (as is). However, there will be an error if your operation's name isn't really
MyOperation
, but rather something likeInsertOperation
orAddOperation
or something that falls into "CRUD" (Create Read Update Delete operations). That is caused some conventions in the RIA Services (which you can read about here).To work around that, you can either use a name that doesn't fall into those conventions, or you can specify the operation to be an Invoke Operation by using the
InvokeAttribute
like so:Hope this helps :)