DOWNLOAD THE CODE:
Download the Code 96772.zip

Methods
The methods component defines the methods by which you can locate instances of an entity, much like an interface definition. For example, a method can be a SQL statement, a stored procedure for a database, or a Web method for a Web service. Certain methods must be defined for certain SharePoint functionality to function. For example, you must define an IDEnumerator method if the data is to be indexed by the search engine. This method returns all the valid Entity IDs so that it can crawl through all instances of the entity. The MOSS 2007 software development kit (SDK), available at http://msdn2.microsoft.com/en-us/library/ms550992.aspx, provides more details about methods instance types and how to use them for different types of SharePoint functionality.

Listing 3, shows that for the Actor entity, I've defined two methods: GetActors and GetMoviesForActor. Both of these run appropriate SQL statements to return the desired result based on some input parameters. For each entity you must define a method instance that will return one instance of that entity (type=SpecificFinder) and a method instance to return multiple instances of that entity (type=Finder). Failure to do so will result in errors when you use a Web Part, list, or search to consume the data. In this example, I use the GetActors method to return one or all of the actors.

Parameters
You need to define input parameters that will be used as filters to queries at the backend. Some default Web Parts let you choose which input parameters to filter on. You also need to define the return parameters for each method. You can see in Listing 4, that I defined a filter called Name that will perform a wildcard comparison. I then associated that filter with the input parameter that relates to the ActorName column (see the AssociatedFilter attribute of the TypeDescriptor node that describes the Actor Name input parameter).

Listing 2 also shows a parameter whose name attribute is Actors. This is where I describe which columns from the table I want returned and what display names to use for them.

Actions
Actions are independent operations that can apply to an entity. You describe them in the BDC, and they're surfaced in the relevant places. For example, defined actions will appear in the Actions menu of the Business Data List Web Part. You can use them to do almost anything—such as, provide a quick link to the source data through the source application for full access to the data or link to any location based on the returned data. For example, you might want to link to a Google or Windows Live search and pass a piece of returned data into the search.

View Profile is a default action that you get with every entity. You can see in Web Listing 1 (which you can view at http:// www.windowsitpro.com, InstantDoc ID 96772) that I added two other actions. One will feed the actor's name into a search on the Internet Movie Database, and the other will launch the URL that's associated with the WebLink column in the actor's entry in the Actors table. You can also add more actions through SharePoint after the entity is defined within the BDC.

Associations
Associations link entities together. A typical example would be two tables in a database that have a one-to-many relationship. In our example, I use a relationship to link an actor to the movies he or she appears in, as Web Listing 2 shows. The association defines the name of the method to use to form such a relationship.

As you can see, defining the contents of the ADF requires knowledge about the implementation of the back-end application. Creating the correct XML is never a trivial task, but you can find XML samples that use the Adventure-Works2000 SQL Server sample database in the MOSS SDK. There are also some community tools and third-party applications—such as http://www.bdcmetaman.com/default.aspx— starting to appear that can help generate the right ADF for the job at hand.

Importing an ADF
After you define the ADF, you have to import it into the Shared Services Provider; the BDC is a shared service and as such can be used by any Web Application or site that's associated with that shared service. You do this from the Shared Services Provider Administration Web application, which is accessible through SharePoint Central Administration. The import analyzes the XML, verifies that it's conformant, and loads all the metadata definitions into the shared services database. Once this is complete, the entities within the shared services database are available for consumption by other parts of SharePoint (e.g., Web Parts, lists, user profiles, and search). Web Figure 1 shows the Actor entity as it appears in Shared Services Provider Administration after the ADF file has been successfully imported. The displayed fields are those that I defined in the ADF—and in this example, they correspond to all the fields in the source table—but it's up to the designer of the ADF to decide how much data to surface from the underlying source. You can also see the relationship I defined and the three actions. Next, let's see how this catalog of definitions can be consumed by other components such as Web Parts, lists, and search.

BDC Web Parts
Out of the box, you get six BDC Web Parts that you can use to display entities from the BDC. You can connect Web Parts to build very sophisticated Web pages. So let's see how we can use the Business Data List Web Part and Business Data Related List Web Part together.

Prev. page     1 [2] 3     next page



You must log on before posting a comment.

If you don't have a username & password, please register now.

Reader Comments

very good

hongde

Article Rating 5 out of 5

 
 

ADS BY GOOGLE