2009-02-05 2 views

답변

6

IDE를 사용하는 대신 빌드 스크립트를 통해 svcutil을 명령 줄에 사용할 수 있습니까? 그런 다음해야 할 일은 박쥐/스크립트/무엇이든 다시 실행하는 것입니다.

+0

이것은 우리가 내 가게에서하는 일입니다. 우리는 항상 비주얼 빌드에서 모든 프록시와 참조를 다시 빌드합니다 ... –

+0

나는 이것도 투표하고 있습니다. 빌드 자동화는 갈 길이 멀다. –

+0

svcutil 명령을 통해 WSDL 서비스 참조 업데이트를 수행하는 방법에 대한 예제가 있습니까? – D3vtr0n

0

나는 그것을 피할 수 있으면 IDE 메커니즘을 통해 WCF 서비스에 대한 참조를 설정하는 것을 선호합니다. 나는 단순히 별도의 클래스 라이브러리에 프록시를 제공하는 편이 낫다. 그렇게되면 일반적으로 소스 코드 저장소의 업데이트가 로컬 복사본의 빌드를 깨뜨리고 변경해야 할 사항이 있음을 알 수 있습니다. 결국, 공용 인터페이스 변경만큼 고통 스럽습니다. 나는 svcutil.exe의 팬이 아니다.

1

나는 생성 된 프록시를 전혀 사용하지 않습니다. 방금 서비스 계약 인터페이스와 다음과 같은 손재주를 정의하는 클라이언트와 서버간에 공유 어셈블리가 있습니다.

// this class can be used to instantiate a unidirectional proxy (one that doesn't require callbacks from the server) 
    public class UniDirectionalServiceProxy<T> : System.ServiceModel.ClientBase<T> where T : class 
    { 
     public UniDirectionalServiceProxy() 
     { 
     } 

     public UniDirectionalServiceProxy(string endpointConfigurationName) : 
      base(endpointConfigurationName) 
     { 
     } 

     public UniDirectionalServiceProxy(string endpointConfigurationName, string remoteAddress) : 
      base(endpointConfigurationName, remoteAddress) 
     { 
     } 

     public UniDirectionalServiceProxy(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
      base(endpointConfigurationName, remoteAddress) 
     { 
     } 

     public UniDirectionalServiceProxy(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
      base(binding, remoteAddress) 
     { 
     } 

     // new keyword allows us to supercede the inherited protected member and make it public. 
     public new T Channel 
     { 
      get 
      { 
       return base.Channel; 
      } 
     } 
    } 

친숙한가요? 해당 객체를 만든 다음 채널 멤버를 사용하도록 호출을 변경하면됩니다.

또한 ChannelFactory를 사용하여 개발자가 ChannelFactory를 사용하도록 ClientBase의 보호 된 멤버를 만든 것으로 추정되지만, 나는이 메커니즘을 선호합니다. 이는 통신을 캡슐화하는 단일 객체로 끝나기 때문에 좋습니다. 제어 및 전선을 통한 통화 분명히, 이렇게하면 svcutil에서 비동기 메소드를 잃어 버릴 수 있습니다.하지만 어쨌든 델리게이트를 사용하는 것은 쉽습니다.