private static IOperationContext GetContext() { var owner = OperationContext.Current; if (owner != null && owner.IsClientSideContext()) { owner = null; } WcfOperationContext context = FindContext(owner); if (context == null) { if (owner != null) { context = new WcfOperationContext(owner, PlatformContext.RequestFromHttpContext()); owner.Extensions.Add(context); // backup in case we can't get to the server-side OperationContext later CallContext.LogicalSetData(CallContextProperty, new ObjectHandle(context)); } // no server-side OperationContext to attach to } return(context); }
private static IOperationContext GetContext() { var owner = OperationContext.Current; if (owner != null && owner.IsClientSideContext()) { owner = null; } var context = FindContext(owner); if (context == null) { if (owner != null) { context = new WcfOperationContext(owner, PlatformContext.RequestFromHttpContext()); owner.Extensions.Add(context); } // no server-side OperationContext to attach to } return(context); }