Skip to main content
The metadata models API provides the foundation for accessing and working with Intent Architect’s design-time metadata. These interfaces represent elements from your designers (classes, operations, attributes, etc.).

Core Interfaces

IMetadataModel

Base interface for all metadata model elements.
Id
string
Unique identifier for the metadata element
Name
string
Display name of the element
Comment
string
Optional comment/description text

IElement

Represents a metadata element with full hierarchy support.
Id
string
Unique identifier for the element
Name
string
Element name
SpecializationType
string
The specialization type name (e.g., “Class”, “Operation”, “Attribute”)
SpecializationTypeId
string
Unique identifier for the specialization type
ChildElements
IEnumerable<IElement>
Child elements in the hierarchy
Stereotypes
IEnumerable<IStereotype>
Applied stereotypes
Package
IPackage
Parent package containing this element

IElementWrapper

Wrapper interface for accessing the underlying IElement.
InternalElement
IElement
Access to the underlying IElement instance
IElementWrapper.cs
using Intent.Metadata.Models;

namespace Intent.Modules.Common;

public interface IElementWrapper
{
    IElement InternalElement { get; }
}

Extension Methods

ElementExtensions

Utility methods for querying and filtering metadata elements.

GetElementsOfType

Filter elements by specialization type ID
IEnumerable<IElement> GetElementsOfType(
    this IEnumerable<IElement> elements,
    string typeId,
    bool recursiveSearch = false)
elements
IEnumerable<IElement>
Collection of elements to search
typeId
string
The specialization type ID to filter by
Whether to search child elements recursively

GetMatchedElements

Filter elements using a custom predicate function
IEnumerable<IElement> GetMatchedElements(
    this IEnumerable<IElement> elements,
    Func<IElement, bool> matchFunc,
    bool recursiveSearch)
elements
IEnumerable<IElement>
Collection of elements to search
matchFunc
Func<IElement, bool>
Predicate function for matching elements
recursiveSearch
bool
Whether to search child elements recursively

Usage Examples

Querying Elements by Type

// Get all class elements from a designer
var classes = package.ChildElements
    .GetElementsOfType("d384db9c-a279-45e1-801e-e4e8099625f2");

// Recursively find all operations
var operations = package.ChildElements
    .GetElementsOfType(operationTypeId, recursiveSearch: true);

Custom Element Filtering

// Find elements with specific naming pattern
var matchedElements = elements.GetMatchedElements(
    e => e.Name.StartsWith("Get"),
    recursiveSearch: false);

// Find elements with specific stereotype
var taggedElements = elements.GetMatchedElements(
    e => e.Stereotypes.Any(s => s.Name == "API"),
    recursiveSearch: true);

Accessing Element Properties

public class MyModel : IMetadataModel, IElementWrapper
{
    private readonly IElement _element;

    public MyModel(IElement element)
    {
        _element = element;
    }

    public string Id => _element.Id;
    public string Name => _element.Name;
    public IElement InternalElement => _element;

    public IEnumerable<IStereotype> Stereotypes => _element.Stereotypes;
}

Trait Interfaces

IInvokableModel

Marker interface indicating an element can be invoked from a Processing Handler (e.g., Commands, Queries, Operations on Services).
public interface IInvokableModel : IElementWrapper, IMetadataModel
{
}

IAllowCommentModel

Indicates the element supports comment/documentation text.

IProcessingHandlerModel

Represents a processing handler element that can invoke operations.

Best Practices

Use Type-Safe Wrappers

Create strongly-typed model classes that implement IElementWrapper rather than working directly with IElement

Cache Element Queries

Cache results from GetElementsOfType when you need to access them multiple times

Validate Element Types

Always verify an element’s SpecializationTypeId matches your expectations before casting

Handle Null References

Check for null when accessing Package or parent elements as they may not always be present

See Also

Build docs developers (and LLMs) love