Share via


How to: Publish a .NET Connectivity Assembly to the BDC Metadata Store

Applies to: SharePoint Server 2010

To import a .NET Connectivity Assembly into the BDC Metadata Store, perform the following steps.

  1. Import an empty BDC Model. The .NET assembly must exist in a LobSystem in the BDC Metadata Store. Therefore, before importing the assembly, you must create an empty BDC model and import it into BDC using the SharePoint Central Administration.

    The LobSystem name you specify here will be what users will see in Microsoft SharePoint Designer 2010 when they try to create external content types.

    1. Copy the following model into a text file, and then save it as XML (for example, c:\InitialModel.xml).

      <?xml version="1.0" encoding="utf-8" standalone="yes"?>
      <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="https://schemas.microsoft.com/windows/2007/BusinessDataCatalog BDCMetadata.xsd"
             xmlns="https://schemas.microsoft.com/windows/2007/BusinessDataCatalog"
             Name="DotNetAssembly_Model">
        <LobSystems>
          <LobSystem Name="ExchangeSample" Type="DotNetAssembly">
            <LobSystemInstances>
              <LobSystemInstance Name="MyLSI">
              </LobSystemInstance>
            </LobSystemInstances>
          </LobSystem>
        </LobSystems>
      </Model>
      
    2. Import the model by following the instructions in Manage BDC Models.

  2. After you have a model in the BDC Metadata Store, execute the Import-SPBusinessDataCatalogDotNetAssemblyWindows PowerShell command to import the primary .NET assembly and its dependent assemblies.

    • Open SharePoint Management Shell. First, execute the commands to get the LobSystem from the Administration Metadata Catalog. Then, execute the SPBusinessDataCatalogDotNetAssembly cmdlet as shown in the following example:

      C:\PS>$site = new-object "Microsoft.SharePoint.SPSite" "http://<yourSiteName>"
      C:\PS>$serviceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site)
      C:\PS>$bdcService = new-object "Microsoft.SharePoint.BusinessData.SharedService.BdcService"
      C:\PS>$catalog = $bdcService.GetAdministrationMetadataCatalog($serviceContext)
      C:\PS>$lobsystem = $catalog.GetLobSystem("ExchangeSample")
      C:\PS> Import–SPBusinessDataCatalogDotNetAssembly –LobSystem $lobsystem –Path "c:\ExchangeIntegrationAssembly.dll"

      The Import-SPBusinessDataCatalogDotNetAssembly command has the following syntax:

      Import-SPBusinessDataCatalogDotNetAssembly –LobSystem $lobsystem –path <string> -DependentAssemblyPaths <string list>

      The following is an example using different assemblies.

      C:\PS> Import–SPBusinessDataCatalogDotNetAssembly –LobSystem $lobsystem –Path "c:\Folder\Assembly.dll" –DependentAssemblyPaths "c:\Folder\Assembly2.dll","c:\Folder\Assembly3.dll"

      Note

      The types that are referenced from the BDC model must be defined in the primary assembly. Dependent assemblies are usually used for helper methods or utility functions.

  3. Restart Internet Information service (if needed). If you change your assembly after importing it, you will need to restart IIS after executing the Import–SPBusinessDataCatalogDotNetAssembly command. This is not required the first time you import the model.