Condividi tramite


Sample BDC Model: Connecting to a .NET Connectivity Assembly

Applies to: SharePoint Server 2010

The following example shows a simple model of an external system of type DotNetAssembly. It demonstrates how to use the Class property to configure connection to the .NET Framework assembly.

Note

The assembly must be deployed to the BDC or to the global assembly cache before executing the methods.

Example

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Model Name="ExampleApplicationDefinition" xmlns="https://schemas.microsoft.com/windows/2007/BusinessDataCatalog">
  <LobSystems>
    <LobSystem Name="ExampleCRM" Type="DotNetAssembly">
      <LobSystemInstances>
        <LobSystemInstance Name="ExampleServer" />
      </LobSystemInstances>
      <Entities>
        <Entity Name="Customer" Namespace="example.com" Version="1.0.0.0">
          <Properties>
            <Property Name="Class" Type="System.String">ExampleCrmNamespace.Customer, ExampleCRM</Property>
          </Properties>
          <Identifiers>
            <Identifier Name="CustomerIdentifier" TypeName="System.Int32" />
          </Identifiers>
          <Methods>
            <Method Name="GetCustomers">
              <Parameters>
                <Parameter Name="CustomerId" Direction="In">
                  <TypeDescriptor Name="Id" TypeName="System.Int32" IdentifierName="CustomerIdentifier" />
                </Parameter>
                <Parameter Name="Customers" Direction="Return">
                  <TypeDescriptor Name="CustomerArray" TypeName="ExampleCrmNamespace.Customer[], ExampleCRM" IsCollection="true">
                    <TypeDescriptors>
                      <TypeDescriptor Name="Customer" TypeName="ExampleCrmNamespace.Customer, ExampleCRM">
                        <TypeDescriptors>
                          <TypeDescriptor Name="Id" TypeName="System.Int32" IdentifierName="CustomerIdentifier" />
                          <TypeDescriptor Name="FirstName" TypeName="System.String" />
                          <TypeDescriptor Name="LastName" TypeName="System.String" />
                        </TypeDescriptors>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </Parameter>
              </Parameters>
              <MethodInstances>
                <MethodInstance Name="GetCustomer" Type="SpecificFinder" ReturnParameterName="Customers" ReturnTypeDescriptorPath="CustomerArray[0]" />
              </MethodInstances>
            </Method>
          </Methods>
        </Entity>
      </Entities>
    </LobSystem>
  </LobSystems>
</Model>