Search Results for

    Show / Hide Table of Contents

    Interface IModel

    Inherited Members
    System.IDisposable.Dispose()
    Namespace: Xbim.Common
    Assembly: Xbim.Common.dll
    Syntax
    public interface IModel : IDisposable

    Properties

    | Improve this Doc View Source

    CurrentTransaction

    It is a good practise to implement this property with WeakReference back field so it gets disposed when transaction goes out of the scope. It would stay alive otherwise which is not desired unless you want to keep it for undo-redo sessions. But even it that case it should be referenced from elsewhere.

    Declaration
    ITransaction CurrentTransaction { get; }
    Property Value
    Type Description
    ITransaction
    | Improve this Doc View Source

    EntityCache

    Entity cache created with BeginEntityCaching(). This should be a weak reference internally.

    Declaration
    IEntityCache EntityCache { get; }
    Property Value
    Type Description
    IEntityCache
    | Improve this Doc View Source

    GeometryStore

    Returns a geometry store, null if geometry storage is not supported

    Declaration
    IGeometryStore GeometryStore { get; }
    Property Value
    Type Description
    IGeometryStore
    | Improve this Doc View Source

    Header

    Declaration
    IStepFileHeader Header { get; }
    Property Value
    Type Description
    IStepFileHeader
    | Improve this Doc View Source

    InstanceHandles

    Declaration
    IList<XbimInstanceHandle> InstanceHandles { get; }
    Property Value
    Type Description
    System.Collections.Generic.IList<XbimInstanceHandle>
    | Improve this Doc View Source

    Instances

    All instances which exist within a scope of the model. Use this property to retrieve the data from model.

    Declaration
    IEntityCollection Instances { get; }
    Property Value
    Type Description
    IEntityCollection
    | Improve this Doc View Source

    InverseCache

    Inverse cache created with BeginInverseCaching(). This should be a weak reference internally.

    Declaration
    IInverseCache InverseCache { get; }
    Property Value
    Type Description
    IInverseCache
    | Improve this Doc View Source

    IsTransactional

    Declaration
    bool IsTransactional { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Logger

    Logger abstraction to be used by the model

    Declaration
    ILogger Logger { get; set; }
    Property Value
    Type Description
    Microsoft.Extensions.Logging.ILogger
    | Improve this Doc View Source

    Metadata

    Metadata representing current data schema of the model. This keeps pre-cached reflection information for efficient operations on the schema.

    Declaration
    ExpressMetaData Metadata { get; }
    Property Value
    Type Description
    ExpressMetaData
    | Improve this Doc View Source

    ModelFactors

    If model contains a geometry and if IModel implementation supports it this property will return conversion factors for base units to be used for geometry processing and other tasks.

    Declaration
    IModelFactors ModelFactors { get; }
    Property Value
    Type Description
    IModelFactors
    | Improve this Doc View Source

    SchemaVersion

    Predefined schemas supported by xBIM

    Declaration
    XbimSchemaVersion SchemaVersion { get; }
    Property Value
    Type Description
    XbimSchemaVersion
    | Improve this Doc View Source

    Tag

    Declaration
    object Tag { get; set; }
    Property Value
    Type Description
    System.Object
    | Improve this Doc View Source

    UserDefinedId

    Returns or sets a user defined id for the model

    Declaration
    int UserDefinedId { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    | Improve this Doc View Source

    Activate(IPersistEntity)

    This function is to be used by entities in the model in cases where data are persisted and entities are activated on-the-fly as their properties are accessed.

    Declaration
    bool Activate(IPersistEntity owningEntity)
    Parameters
    Type Name Description
    IPersistEntity owningEntity

    Entity to be activated

    Returns
    Type Description
    System.Boolean

    True if activation was successful, False otherwise

    | Improve this Doc View Source

    BeginEntityCaching()

    This will start to cache entities if IModel implementation uses any kind of on-demand data loading and entity activation. This will keep entities alive and will minimize number of read operations needed to get data. It will also grow in memory which might not be desired. Always use this in using statement or dispose the object explicitly.

    Declaration
    IEntityCache BeginEntityCaching()
    Returns
    Type Description
    IEntityCache
    | Improve this Doc View Source

    BeginInverseCaching()

    This will start to cache inverse relations which are heavily used in EXPRESS schema to model bidirectional relations. You shouldn't only use cache outside of transaction when you query the data but you don't change any values. Implementations of IModel might throw an exception in case you call this function inside of transaction or if you begin transaction before you stop caching. You should always keep the caching object inside of using statement as IModel should only hold the weak reference to it.

    Declaration
    IInverseCache BeginInverseCaching()
    Returns
    Type Description
    IInverseCache
    | Improve this Doc View Source

    BeginTransaction(String)

    Begins transaction on the model to handle all modifications. You should use this function within a 'using' statement to restrict scope of the transaction. IModel should only hold weak reference to this object in 'CurrentTransaction' property.

    Declaration
    ITransaction BeginTransaction(string name)
    Parameters
    Type Name Description
    System.String name

    Name of the transaction. This is useful in case you keep the transactions for undo-redo sessions

    Returns
    Type Description
    ITransaction

    Transaction object.

    | Improve this Doc View Source

    Delete(IPersistEntity)

    Deletes entity from the model and removes all references to this entity in all entities in the model. This operation is potentially very expensive and some implementations of IModel might not implement it at all.

    Declaration
    void Delete(IPersistEntity entity)
    Parameters
    Type Name Description
    IPersistEntity entity
    | Improve this Doc View Source

    ForEach<TSource>(IEnumerable<TSource>, Action<TSource>)

    Performs a set of actions on a collection of entities inside a single read only transaction This improves database performance for retrieving and accessing complex and deep objects

    Declaration
    void ForEach<TSource>(IEnumerable<TSource> source, Action<TSource> body)
        where TSource : IPersistEntity
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<TSource> source
    System.Action<TSource> body
    Type Parameters
    Name Description
    TSource
    | Improve this Doc View Source

    InsertCopy<T>(T, XbimInstanceHandleMap, PropertyTranformDelegate, Boolean, Boolean)

    Implementation of IModel variant of InsertCopy() function

    Declaration
    T InsertCopy<T>(T toCopy, XbimInstanceHandleMap mappings, PropertyTranformDelegate propTransform, bool includeInverses, bool keepLabels)
        where T : IPersistEntity
    Parameters
    Type Name Description
    T toCopy

    Object to copy

    XbimInstanceHandleMap mappings

    Mappings make sure object is only inserted once. You should use one instance of mappings for all InsertCopy() calls between two models

    PropertyTranformDelegate propTransform

    Delegate which can be used to transform properties. You can use this to filter out certain properties or referenced objects

    System.Boolean includeInverses

    If TRUE inverse relations are also copied over. This may potentially bring over almost entire model if not controlled by propTransform delegate

    System.Boolean keepLabels

    If TRUE entity labels of inserted objects will be the same as the labels of original objects. This should be FALSE if you are inserting objects to existing model or if you are inserting objects from multiple source models into a single target model where entity labels may potentially clash.

    Returns
    Type Description
    T

    New created object in this model which is a deep copy of original object

    Type Parameters
    Name Description
    T

    Type of the object to be inserted. This must be a type supported by this model

    Events

    | Improve this Doc View Source

    EntityDeleted

    This event is fired every time when entity gets deleted from model.

    Declaration
    event DeletedEntityHandler EntityDeleted
    Event Type
    Type Description
    DeletedEntityHandler
    | Improve this Doc View Source

    EntityModified

    This event is fired every time any entity is modified. If your model is not transactional it might not be called at all as the central point for all modifications is a transaction.

    Declaration
    event ModifiedEntityHandler EntityModified
    Event Type
    Type Description
    ModifiedEntityHandler
    | Improve this Doc View Source

    EntityNew

    This event is fired every time new entity is created.

    Declaration
    event NewEntityHandler EntityNew
    Event Type
    Type Description
    NewEntityHandler
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2022 xbim