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.
}
});
精彩评论