I have a Silverlight appli开发者_开发问答cation 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!
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 like InsertOperation
or AddOperation
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:
[Invoke]
public void AddOperation(string userName, bool isActive, string emailAddress)
{
// Do Stuff
}
Hope this helps :)
精彩评论