![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | IOperationInvoker I find this to be a very interesting interface yet I am having a nearly impossible time finding any information on it (try a google search or a MSDN search). It appears to allow for method interception and makes the attribute something quite similar to an aspect. Can anyone let me know about the context in which it is used or even better forward me off to some places I can look up more information on it? Thanks in advance, Greg |
| | #2 (permalink) |
| Guest | RE: IOperationInvoker Hi; There is a list of blogs at http://windowscommunication.net the one by Ralph Squillace (http://blogs.msdn.com/ralph.squillace/) is "The Place for Windows Communication Framework ("Indigo") Developer Documentation and Sample Code" There are others as well. Regards Manny "gregoryyoung1@gmail.com" wrote: > I find this to be a very interesting interface yet I am having a nearly > impossible time finding any information on it (try a google search or a > MSDN search). > > It appears to allow for method interception and makes the attribute > something quite similar to an aspect. > > Can anyone let me know about the context in which it is used or even > better forward me off to some places I can look up more information on > it? > > Thanks in advance, > > Greg > > |
| | #3 (permalink) |
| Guest | Re: IOperationInvoker IParameterInspector is probably a better place for interception. Note that if you implement a parameter inspector and ypour interceptor does not want to let the call pass because it is probably a validation thing of some sort, you will also have to implement IErrorHandler. Here is a cleaned out skeleton: using System; using System.Collections.Generic; using System.Text; using System.ServiceModel; namespace MyStuff { [AttributeUsage(AttributeTargets.Interface|AttributeTargets.Class)] public class MyBehavior : Attribute, IContractBehavior, IErrorHandler { #region IContractBehavior Members //Service side hookup public void BindDispatch(ContractDescription description, IEnumerable<ServiceEndpoint> endpoints, DispatchBehavior dispatch, BindingParameterCollection parameters) { dispatch.ErrorHandlers.Add(this); foreach (DispatchOperation dispOp in dispatch.Operations) { OperationDescription operationDescription = description.Operations.Find(dispOp.Name); operationDescription.Faults.Add(new FaultDescription("http://example.com/2006/01/myapp/fault")); dispOp.ParameterInspectors.Add(new MyParameterInspector(operationDescription)); } } // Proxy side hookup public void BindProxy(ContractDescription description, ServiceEndpoint endpoint, ProxyBehavior proxy, BindingParameterCollection parameters) { foreach (ProxyOperation prxOp in proxy.Operations) { prxOp.ParameterInspectors.Add(new MyParameterInspector(description.Operations.Find(prxOp.Name))); } } #endregion #region IErrorHandler Members public bool HandleError(Exception error, MessageFault fault) { return (error is MyKnownExceptionType); } public void ProvideFault(Exception error, ref MessageFault fault, ref string faultAction) { if (error is MyKnownExceptionType) { ConstraintViolationException constraintError = error as ConstraintViolationException; fault = MessageFault.CreateFault( FaultCode.CreateReceiverFaultCode("MyError", "http://example.com/2006/01/myapp"), new FaultReason(constraintError.Message)); faultAction = "http://example.com/2006/01/myapp/fault"; } else { fault = null; } } #endregion } } <gregoryyoung1@gmail.com> wrote in message news:1138222574.167864.53750@g14g2000cwa.googlegroups.com... >I find this to be a very interesting interface yet I am having a nearly > impossible time finding any information on it (try a google search or a > MSDN search). > > It appears to allow for method interception and makes the attribute > something quite similar to an aspect. > > Can anyone let me know about the context in which it is used or even > better forward me off to some places I can look up more information on > it? > > Thanks in advance, > > Greg > |
| |
| |