Expose Methods for Extensibility - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

You can expose methods through the OData services using the ExposedService attribute. The classes are imported through MEF, so you must ensure that your code is in a module or a custom assembly.

To expose a method through the API Services, you must:

  1. Implement the Intergraph.SPF.Server.API.Extensibility.IServicesExposesProcedures interface.

  2. Export the interface through MEF.

  3. Add the ExposedService attribute to the methods that you want to expose. For more information, see ExposedService attribute parameters.

  4. If desired, you can add the following attributes to the methods:

    • SetSPFConfig - This attribute sets the configuration to the value provided in the request header or to the user's default configuration.

    • AllowAnonymous - This attribute allows access to the service without being logged in.

To ensure that your custom assembly is loaded by the SmartPlant Foundation server, you must name the custom assembly so it begins with Intergraph. For example, Intergraph.MyCustomAssembly.dll. The Intergraph.MyCustomAssembly.dll must then be located in the [SmartPlant Foundation server virtual directory]\bin folder. However, if your assembly name does not begin with Intergraph, it must be located in the [SmartPlant Foundation server virtual directory]\bin\custom folder.