2009-06-15 3 views
2

(공급자) businessdata 필터 webpart에서 BDC 목록 WebPart에 "쿼리 값"을 제공하려고합니다. 연결하려고하면 오류가 발생합니다. "공급자 연결 지점 (BusinessDataFilterWebPart)과 소비자 연결 지점"BusinessDataListWebPart "는 동일한 연결 인터페이스를 사용하지 않습니다."BDC 웹 파트 연결 인터페이스 오류

다음은 제 코드입니다.

System.Web.UI.WebControls.WebParts.WebPart providerWebPart = 
       webPartManager.WebParts[filterWebPart.ID]; 
      ProviderConnectionPointCollection providerConnections = 
       webPartManager.GetProviderConnectionPoints(providerWebPart); 
      ProviderConnectionPoint providerConnection = null; 
      foreach (ProviderConnectionPoint ppoint in providerConnections) 
      { 
       if (ppoint.InterfaceType == typeof(ITransformableFilterValues)) 
        providerConnection = ppoint; 

      } 
      System.Web.UI.WebControls.WebParts.WebPart consumerWebPart = 
       webPartManager.WebParts[consumer.ID]; 
      ConsumerConnectionPointCollection consumerConnections = 
       webPartManager.GetConsumerConnectionPoints(consumerWebPart); 
      ConsumerConnectionPoint consumerConnection = null; 

      foreach (ConsumerConnectionPoint cpoint in consumerConnections) 
      { 
       if (cpoint.InterfaceType == typeof(IWebPartParameters)) 
        consumerConnection = cpoint; 
      } 

SPWebPartConnection newConnection = webPartManager.SPConnectWebParts(
       providerWebPart, providerConnection, consumerWebPart, consumerConnection); 

답변

0

두 개의 다른 연결 인터페이스를 비교하는 것처럼 보입니다. 공급자 연결은 ITransformableFilterValues를 구현하고 소비자 연결은 IWebPartParameters를 구현합니다.

코드의 웹 파트 간 연결을 거의 작성하지 않아서 작성한 코드에 대해 잘 모릅니다. 그러나 연결에 대한 요점은 소비자와 공급자가 동일한 인터페이스를 제공하고 기대해야한다는 것입니다.

브라우저 인터페이스에서이 두 웹 파트를 함께 연결해 보았습니까?

0

이 문제에 대한 직접적인 경험은 쿼리 문자열 필터 웹 파트를 공급자로 사용하고 보고서 뷰어 웹 파트를 소비자로 사용하는 것이지만 문제는 동일합니다.

ITransformableFilterValues ​​인터페이스는 IWebPartParameters 인터페이스에서 사용할 수 없습니다. 그러나 연결 지점 컬렉션의 각 항목은 다른 인터페이스 유형을 구현합니다.

디버거에서 ConsumerConnectionPointCollection 및 ProviderConnectionPointConnection에 의해 구현 된 다른 인터페이스 유형을 확인하십시오. 두 콜렉션 모두 동일한 인터페이스 유형을 구현하는 연결이있는 경우, 인터페이스 유형을 점검중인 foreach에서 해당 인터페이스 유형을 사용하십시오.

직접 일치하는 항목이없는 경우 올바른 조합을 찾으려면 실험을해야합니다.

0

두 개의 인터페이스를 연결/변환 할 수 있도록 올바른 변압기와 변환 방법을 매개 변수로 사용해야합니다. TransformableFilterValuesToParametersTransformer에 MSDN 설명서에서 :

var transformer = new TransformableFilterValuesToParametersTransformer(); 
       transformer.ProviderFieldNames = new string[] { "DocumentIdForCurrentPage" }; 
       transformer.ConsumerFieldNames = new string[] { "DocumentId" }; 

webPartManager.SPConnectWebParts ( providerWebPart, providerConnection을 "IWebPartParameters을 소비 할 수있는 웹 파트에 연결 Microsoft.SharePoint.WebPartPages.ITransformableFilterValues ​​구현 표준 필터를, 할 수 있습니다" consumerWebPart, consumerConnection, transformer);