WCF RIA 服务是否支持自定义方法? 我还能在哪个 dll 中找到“[Custom]”属性?
最佳答案
是的,WCF RIA 服务可以支持自定义方法。
您将使用 [Invoke] 属性指定装饰您的自定义方法。 例如:
[EnableClientAccess()]
public class TestDomainService : LinqToEntitiesDomainService<TestEntities>
{
[Invoke]
public Test CustomMethodFetch(Guid testId)
{
...
return foundTest;
}
}
.. 你会用...来调用它
var ctx = new TestDomainContext();
ctx.CustomMethodFetch( testId, (op) =>
{
if (op.HasError)
// Handle errors.
else
{
var testEntity = op.Value;
// Do stuff.
}
});
关于WCF RIA 服务自定义方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2414858/