Share via

XML Snippet: Modeling a Deleter Method

Applies to: SharePoint Server 2010

The following is an example of a Deleter method in a BDC model. Notice that this is a simple example and does not account for any foreign key constraints in the database.


<Method Name="Delete" DefaultDisplayName="SalesReason Delete">
    <Property Name="BackEndObject" Type="System.String">
    <Property Name="BackEndObjectType" Type="System.String">
    <Property Name="RdbCommandText" Type="System.String">
      DELETE FROM [Sales].[SalesReason] 
      WHERE [SalesReasonID] = @SalesReasonID</Property>
    <Property Name="RdbCommandType" Type="System.Data.CommandType, 
              System.Data, Version=, Culture=neutral, 
    <Property Name="Schema" Type="System.String">Sales</Property>
    <Parameter Direction="In" Name="@SalesReasonID">
      <TypeDescriptor TypeName="System.Int32" 
                      Name="SalesReasonID" />
    <MethodInstance Type="Deleter" 
                    DefaultDisplayName="SalesReason Delete" />

For a complete BDC model sample that includes a Deleter, do the following:

  1. Download the Microsoft SharePoint 2010 SDK.

  2. Extract "bcs sample" from "%ProgramFiles%\Microsoft SDKs\SharePoint 2010\Samples\Business Connectivity Services" to a local folder.

  3. In the folder where you extracted the files, locate the "BDC Models for XML Snippets" folder. This folder contains BDC model samples.