Muokkaa

Jaa


Expose adapter settings as a binding property using the WCF LOB Adapter SDK

The WCF LOB Adapter SDK uses the properties defined in different classes for configuring the connection pool, metadata cache, and other adapter behaviors. This topic describes how you can surface these properties as binding properties, so that the adapter consumer can set them through a configuration file.

To surface an adapter setting as an adapter binding property

  1. Start Visual Studio, and then on the File menu, point to New, and then click Project.

  2. Choose the WCF LOB Adapter template, and then provide the other adapter project information.

  3. Step through the WCF LOB Adapter Development Wizard. When you get to the Adapter Properties page, add the binding properties that you want to expose by providing a Property name, Data type, and Default value, and then click Add to add the new adapter property.

  4. Complete the Adapter Development Wizard. Your project should contain new files provided by the wizard.

  5. In Visual Studio, in Solution Explorer, open the adapter-derived class. For example, if the name of your adapter project is "SampleAdapter", the adapter derived class can be found in "SampleAdapter.cs".

  6. Remove the private variables for the properties that you want to get and set from adapter settings. The private variables were generated by the Adapter Development Wizard.

  7. Update the get/set methods to read/write values from/to adapter settings. The following example uses an adapter property to allow enablement of performance counters.

    [System.Configuration.ConfigurationProperty("enablePerfCounters", DefaultValue = false)]  
    public bool EnablePerfCounters  
    {  
        get { return environmentSettings.PerformanceCounters.Enabled;    }  
        set { environmentSettings.PerformanceCounters.Enabled = value; }  
    }  
    
  8. In Visual Studio, on the File menu, click Save All.

See Also

Tutorial 1: Develop the Echo Adapter Development Activities