나는 랩을 생성하여이 문제를 가지고 가져 오기 프로세스 중에 ClientBase 파생 클래스의 클래스 당. 실제로 클라이언트 클래스와 동일한 이름의 추가 부분 클래스를 생성하려고 시도했지만 나머지 코드 생성이 제대로 작동하지 않게되었습니다.
그래서 내 최종 생성 된 코드는 다음과 같은 :
(에 의해 생성 된 내장 WCF 프록시 생성기) :
public class ServiceReference1Wrapper
{
private ServiceReference1Client _client;
public ServiceReference1Wrapper(ServiceReference1Client client)
{
_client = client;
}
public IObservable<AsyncCompletedEventArgs> WebMethod1()
{
_client.WebMethod1Async();
// ...
}
public IObservable<AsyncCompletedEventArgs> WebMethod2()
{
_client.WebMethod2Async();
// ...
}
// ...
}
:
public interface ServiceReference1
{
IAsyncResult BeginWebMethod1(AsyncCallback callback, object asyncState);
void EndWebMethod1(IAsyncResult result);
IAsyncResult BeginWebMethod2(AsyncCallback callback, object asyncState);
void EndWebMethod2(IAsyncResult result);
// ...
}
public class ServiceReference1Client
{
public event EventHandler<AsyncCompletedEventArgs> WebMethod1Completed;
public event EventHandler<AsyncCompletedEventArgs> WebMethod2Completed;
public void WebMethod1Async() { /* ... */ }
public void WebMethod2Async() { /* ... */ }
// ...
}
(내 사용자 지정 IOperationContractGenerationExtension
에 의해 생성)
참고 : Silverlight를 사용하므로 모든 것이 비동기입니다.
IOperationContextGenerationExtension은 실제로 WCF의 서버 측 확장 점입니다. 달성하고자하는 것은 무엇입니까 ?? 프록시 클래스에 몇 가지 메소드를 추가하기 만하면됩니까? 내 대답을 보라. 더 많은 것을해라 ?? –
IOperationContextGenerationExtension이 서버 측이라고 말하는 것이 정확하지 않다고 생각합니다. 가져 오기 프로세스에 연결되므로 클라이언트 측 (웹 서비스와 관련)입니다. 적어도 그것이 내가 그것을 사용하고있는 방법이다. – dcstraw