DalExportAttribute - STARIONGROUP/COMET-SDK-Community-Edition GitHub Wiki

Overview

The DalExportAttribute is a C# Attribute that is used to decorate implementations of the Dal abstract super class. It is used to dynamicaly load Dal implementations using the Managed Extensibility Framework (MEF).

The DalExportAttribute has 4 properties:

  • Name: A human readable name of the Dal implementation
  • Description: A human readable description of the Dal implementation
  • CDPVersion: The version of the COMET Data Model that is supported by the data-source that this Dal is used to connect to
  • DalType: the type of Dal, this can either be Web or File

The COMETServicesDal implementation is decorated as follows:

[DalExport("CDP4 Services", "A CDP4 Services Data Access Layer", "1.1.0", DalType.Web)]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class CdpServicesDal : Dal
{
    // implementation code here
}

As can be seen, this Dal can only be used with data-sources that support version 1.1.0 of the COMET Data Model.

AvailableDals

The AvailableDals class is used to provide a convenient way to get access to all the Dal implementations that have been dynamically loaded. The CDP4-COMET-IME makes use of this mechanism to let the user select the plugin to use to connect to a web-based or file-based data-source.

var availableDals = ServiceLocator.Current.GetInstance<AvailableDals>();