开发者

WCF RIA services custom methods?

Does WCF RIA开发者_C百科 services supports custom methods? also in which dll can i find the "[Custom]" attribute?


Yes WCF RIA services can support custom methods.

You'd specify decorate your custom methods with the [Invoke] attribute. EG:

[EnableClientAccess()]
public class TestDomainService : LinqToEntitiesDomainService<TestEntities>
{
  [Invoke]
  public Test CustomMethodFetch(Guid testId)
  {
    ...
    return foundTest; 
  }
}

.. and you would call it by ...

var ctx = new TestDomainContext();

ctx.CustomMethodFetch( testId, (op) =>
{
  if (op.HasError)
    // Handle errors.
  else
  {
    var testEntity = op.Value;
    // Do stuff.
  }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜