Friday, October 24, 2008

BDC Sample

Scenario:
A Web service proxy class named SurveyWebServiceProxy contains the following method:

public Survey[] GetSurveys() { 
object[] results = this.Invoke("GetSurveys", null);
return ((Survey[])(results[0]));
}
You create the following method for a Survey entity in a Business Data Catalog (BDC) application definition file:
<Method Name="GetSurveys"> 
<Parameters>
<Parameter Name="Surveys" Direction="Return">
<TypeDescriptor
TypeName="SurveyWebServiceProxy.Survey[], SurveyWebService"
IsCollection="true"
Name="ArrayOfSurvey">
<TypeDescriptors>
<TypeDescriptor TypeName="SurveyWebServiceProxy.Survey, SurveyWebService"
Name="Survey">
<TypeDescriptor TypeName="System.Int32" Name="SurveyID"
IdentifierName="SurveyID"/>
<TypeDescriptor TypeName="System.String" Name="Title"/>
</TypeDescriptor>
<TypeDescriptors>
</TypeDescriptor>
</Parameter>
</Parameters>
</Method>
Now to return the default view of the Survey entity.

This configuration creates a Finder method. A Finder method is one that returns multiple entity instances. In this scenario, the method returns multiple instances of the Survey entity.
<MethodInstance 
Type="Finder"
ReturnParameterName="Surveys"
Name="GetSurveys"/>
This configuration creates a SpecificFinder method. A SpecificFinder method is one that returns a single entity instance.
<MethodInstance 
Type="SpecificFinder"
ReturnParameterName="Surveys"
Name="GetSurveys"/>
Also keep in mind that an Association element defines an association between two entities.

0 comments: