WCF ServiceFilter like ASP.NET MVC ActionFilter
let's assume that the below one is our service contract;
using System;
using System.Collections.Generic;开发者_JAVA百科
using System.Text;
using System.ServiceModel;
namespace WCFSimple.Contract
{
[ServiceContract]
public interface IService
{
[OperationContract]
string Ping(string name);
}
}
the thing (I do not know what it is called but would appreciate if somebody could tell me) just above the public interface IService
which is [ServiceContract]
is giving me an idea.
I would like to have a simple thing called ActionFilter on ASP.NET MVC.
Can I do that on WCF? If I can, what can it give me to control there?
You can use PostSharp to do aspect-oriented programming in any .NET program, like ActionFilter in asp.net mvc (OnExecuting/OnBeforeExecuteing/OnExecuted/etc)
精彩评论