Search Results for

    Show / Hide Table of Contents

    Class Model

    Represents a Time Cockpit metadata model

    Inheritance
    System.Object
    DynamicObject
    NamedDynamicObject
    ModelElement
    Model
    Implements
    System.Dynamic.IDynamicMetaObjectProvider
    System.ComponentModel.INotifyPropertyChanged
    System.ComponentModel.IDataErrorInfo
    System.ComponentModel.ISupportInitialize
    Inherited Members
    ModelElement.IsValidIdentifier(String)
    ModelElement.Detach()
    ModelElement.SetOwnershipPrefix(String)
    ModelElement.UpdateChildren(NotifyCollectionChangedEventArgs)
    ModelElement.SetPersistBehavior(PersistBehavior)
    ModelElement.SetName(String)
    ModelElement.SetOwnership(Ownership)
    ModelElement.ElementGuid
    ModelElement.Name
    ModelElement.Parent
    ModelElement.Children
    ModelElement.PersistBehavior
    ModelElement.IsFullPersistBehavior
    ModelElement.IsNonePersistBehavior
    ModelElement.IsSystemElement
    ModelElement.IsApplicationSpecificElement
    ModelElement.IsUserElement
    ModelElement.IsSystemOrApplicationSpecificElement
    ModelElement.InvariantFriendlyName
    ModelElement.CreationVersion
    ModelElement.LastUpdateVersion
    ModelElement.Error
    ModelElement.ErrorSummary
    ModelElement.IsValid
    ModelElement.Ownership
    ModelElement.OwnershipPrefix
    ModelElement.NonPrefixedName
    NamedDynamicObject.OnPropertyChanged(String)
    NamedDynamicObject.PropertyChanged
    DynamicObject.SetMember(String, Object)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: TimeCockpit.Data.DataModel
    Assembly: TimeCockpit.Data.dll
    Syntax
    public sealed class Model : ModelElement, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, ISupportInitialize

    Constructors

    Model()

    Initializes a new instance of the Model class.

    Declaration
    public Model()

    Model(Model)

    Initializes a new instance of the Model class.

    Declaration
    public Model(Model element)
    Parameters
    Type Name Description
    Model element

    The element to copy.

    Remarks

    Copy constructor for copying values of an instance of Model. The constructor copies all the values of the value types, but creates new instances of all ModelEntitys by calling their copy constructor. ModelActions, EntityViews, NamedSetDefinitions and Permissions of the Model to copy are just added to the corresponding collections.

    Properties

    Actions

    Gets the collection used to store all available model actions of a model.

    Declaration
    public ModelCollection<ModelAction> Actions { get; }
    Property Value
    Type Description
    ModelCollection<ModelAction>

    ApplicationSpecificEntities

    Gets the application specific entities of the current model.

    Declaration
    public IEnumerable<ModelEntityBase> ApplicationSpecificEntities { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ModelEntityBase>

    Cultures

    Gets the cultures supported by the current instance of Model.

    Declaration
    public ModelCollection<Culture> Cultures { get; }
    Property Value
    Type Description
    ModelCollection<Culture>

    The cultures.

    Entities

    Gets the collection used to store the entities of the data model.

    Declaration
    public ModelCollection<ModelEntityBase> Entities { get; }
    Property Value
    Type Description
    ModelCollection<ModelEntityBase>

    EntityViews

    Gets the collection used to store all available entity views in a model.

    Declaration
    public ModelCollection<EntityView> EntityViews { get; }
    Property Value
    Type Description
    ModelCollection<EntityView>

    IsFrozen

    Gets a value indicating whether the model is frozen

    Declaration
    public bool IsFrozen { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Frozen models always have TrackChanges = false. You cannot change a frozen model so that it tracks changes.

    See Also
    Freeze()

    LocalModelVersion

    Gets the local version number of this model

    Declaration
    public int LocalModelVersion { get; }
    Property Value
    Type Description
    System.Int32
    Remarks

    The local model version is an internal version counter for the model. Whenever a model change is written to disk the local model version is incremented. Note that this property is not incremented as long as changes have not been written to disk using SaveModel(Model).

    ModelEntityViews

    Gets the collection used to store all available entity views in a model.

    Declaration
    [Obsolete("Use EntityViews instead")]
    public ModelCollection<EntityView> ModelEntityViews { get; }
    Property Value
    Type Description
    ModelCollection<EntityView>

    NamedSetDefinitions

    Gets the collection used to store named set definitions in a model.

    Declaration
    public ModelCollection<NamedSetDefinition> NamedSetDefinitions { get; }
    Property Value
    Type Description
    ModelCollection<NamedSetDefinition>

    Permissions

    Gets the collection used to store allowed permissions.

    Declaration
    public ModelCollection<Permission> Permissions { get; }
    Property Value
    Type Description
    ModelCollection<Permission>

    SkipEntityMemberNameValidation

    Gets or sets a value indicating whether the check for member name equals entity name in model validation should be skipped.

    Declaration
    public static bool SkipEntityMemberNameValidation { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Use with caution! The validation check that can be disabled by this property is required for proper OData/EDM compatibility. For COFX applications that do not require OData/EDM this flag may be set to true.

    SystemEntities

    Gets the collection used to store the system entities of the data model.

    Declaration
    public IEnumerable<ModelEntityBase> SystemEntities { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ModelEntityBase>

    TrackChanges

    Gets a value indicating whether the model is currently tracking changes.

    Declaration
    public bool TrackChanges { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    If TrackChanges is true changes to the model and it's child objects are collected. You can save all changes to a model using the SaveModel(Model) method.

    If TrackChanges is false changes to the model and it's child objects are not collected. As a result you cannot save changes to the underlying data store.

    UserEntities

    Gets the user entities of the current model.

    Declaration
    public IEnumerable<ModelEntityBase> UserEntities { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ModelEntityBase>

    Methods

    Accept(ModelElementVisitor)

    Accepts a visitor. Dispatches the correct visit call (for Model)in the visitor.

    Declaration
    public override void Accept(ModelElementVisitor visitor)
    Parameters
    Type Name Description
    ModelElementVisitor visitor

    the visitor to dispatch to.

    Overrides
    ModelElement.Accept(ModelElementVisitor)

    Attach(ModelElement)

    Attaches a model to a parent model element.

    Declaration
    protected override void Attach(ModelElement newParent)
    Parameters
    Type Name Description
    ModelElement newParent

    Parent model element.

    Overrides
    ModelElement.Attach(ModelElement)
    Exceptions
    Type Condition
    System.InvalidOperationException

    Always thrown because a model cannot be attached to a parent model element.

    Freeze()

    Freezes the model

    Declaration
    public void Freeze()
    See Also
    IsFrozen

    GetDefaultCulture()

    Gets the default culture.

    Declaration
    public Culture GetDefaultCulture()
    Returns
    Type Description
    Culture

    Returns the instance of Culture that is marked as default.

    GetDesiredCultureOrDefault(CultureInfo)

    Tries to find the culture the current thread is using in the model cultures.

    Declaration
    public Culture GetDesiredCultureOrDefault(CultureInfo desiredCulture)
    Parameters
    Type Name Description
    System.Globalization.CultureInfo desiredCulture

    The desired culture.

    Returns
    Type Description
    Culture

    The desired culture or a fallback culture.

    Remarks

    Example: If the current thread culture is de-AT and de-AT is a registered culture in the model the method returns de-AT. If de-AT is not registered in the model, the method checks if the parent culture of the culture of the current thread (in this example de) is registered in the model and if so, returns it. If the parent thread culture is not registered either, the default culture is returned

    GetMember(String)

    Gets a member dynamically.

    Declaration
    public override object GetMember(string name)
    Parameters
    Type Name Description
    System.String name

    Name of the member to get.

    Returns
    Type Description
    System.Object

    Dynamic member.

    Overrides
    DynamicObject.GetMember(String)

    GetMetaObject(Expression)

    Gets the meta object of the dynamic object.

    Declaration
    public override DynamicMetaObject GetMetaObject(Expression parameter)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression parameter

    Provided by the DLR (Dynamic Language Runtime).

    Returns
    Type Description
    System.Dynamic.DynamicMetaObject

    DynamicObject.DynamicMetaObject that represents this specific object’s binding logic.

    Overrides
    DynamicObject.GetMetaObject(Expression)

    GetModelElementByUuid(Guid)

    Gets one of the following model elements according to its guid entities, properties, validation rules, model entity interface

    Declaration
    public ModelElement GetModelElementByUuid(Guid guid)
    Parameters
    Type Name Description
    System.Guid guid

    the guid to search for

    Returns
    Type Description
    ModelElement

    The model element with the given id or null if there is not element with this id.

    HasCultures()

    Determines whether this instance of a model has cultures.

    Declaration
    public bool HasCultures()
    Returns
    Type Description
    System.Boolean

    True if the model contains cultues, else false

    OnDeserializing(StreamingContext)

    Called whenever deserialization of the model element is happening

    Declaration
    [OnDeserializing]
    public void OnDeserializing(StreamingContext context)
    Parameters
    Type Name Description
    System.Runtime.Serialization.StreamingContext context

    Stream context used for deserialization.

    Remarks

    This method is part of the internal infrastructure of the TimeCockpit.Data and must not be called from outside.

    SetDefaultCulture(Culture)

    Sets the default culture.

    Declaration
    public void SetDefaultCulture(Culture proposedDefaultCulture)
    Parameters
    Type Name Description
    Culture proposedDefaultCulture

    The proposed default culture.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown if the proposed culture cannot be found in the model.

    Validate(ref IList<PropertyValidationMessage>, Boolean)

    Validates a ModelElement according to certain rules.

    Declaration
    protected override void Validate(ref IList<PropertyValidationMessage> messages, bool validateRecursively)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<PropertyValidationMessage> messages

    An list of strings that stores that picks up the validation errors of a model element.

    System.Boolean validateRecursively

    Indicates wheter to validate only the current model element or all its children (recursively) as well.

    Overrides
    ModelElement.Validate(ref IList<PropertyValidationMessage>, Boolean)
    Remarks

    The rules the ModelElement is validated against are dependent on the type of ModelElement that is validated. This method can be overridden to provide custom validation behavior for subclasses of ModelElement

    When Validate(ref IList<PropertyValidationMessage>, Boolean) is called on a modelelement, the Validate(ref IList<PropertyValidationMessage>, Boolean) method of all children attatched to the modelelemnt are validated recursivly.

    In This Article
    Back to top Copyright © 2020 software architects gmbh