Table of Contents

Class DependencyEntityObject

Namespace
TimeCockpit.Data
Assembly
TimeCockpit.Data.dll

A wrapper for entity objects, that implements IDataErrorInfo and throws notifications.

public class DependencyEntityObject : DynamicObject, IDynamicMetaObjectProvider, INotifyPropertyChanged, IEntityObject, IDataErrorInfo, IWeakEventListener
Inheritance
Object
DependencyEntityObject
Implements
IDynamicMetaObjectProvider
INotifyPropertyChanged
IDataErrorInfo
IWeakEventListener
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

Constructors

DependencyEntityObject()

Initializes a new instance of the DependencyEntityObject class.

public DependencyEntityObject()

Properties

DataContext

Gets or sets the data context to evaluate permissions

public IDataContext DataContext { get; set; }

Property Value

IDataContext

EntityObject

Gets or sets the underlying EntityObject.

public EntityObject EntityObject { get; set; }

Property Value

EntityObject

Error

Gets an error message indicating why validation fails for this object. This property calls all the ValidationRules of an EntityObject and aggregates their messages if they fail. That is, if an EntityObject validates o.k. the property returns null. Else, it returns the first entry of the list of strings representing the error messages defined in the ValidationRules.

public string Error { get; }

Property Value

String

IsValid

Gets a value indicating whether the EntityObject is valid or not.

public bool IsValid { get; }

Property Value

Boolean

Me

Gets the it self

public EntityObject Me { get; }

Property Value

EntityObject

Remarks

This property is needed for DataBinding reasons. Whenever a property of an EntityObject is changed (e.g. via z.SetMember("X", "Y")), the OnPropertyChanged(String) event of that property + the OnPropertyChanged(String) event of the Me property is fired.

MemberAccessPermissions

Gets the member permission information.

public virtual MemberAccessPermissions MemberAccessPermissions { get; }

Property Value

MemberAccessPermissions

MemberAccessPermissionsInternal

Gets or sets the member access permissions.

protected MemberAccessPermissions MemberAccessPermissionsInternal { get; set; }

Property Value

MemberAccessPermissions

MemberAccessPermissionsLock

Gets the member access permissions lock.

protected object MemberAccessPermissionsLock { get; }

Property Value

Object

ModelEntityName

Gets the name of the current instance of EntityObject

public string ModelEntityName { get; }

Property Value

String

ObjectUuid

Gets the unique id of the object.

public Guid ObjectUuid { get; }

Property Value

Guid

Methods

Create(EntityObject, IDataContext)

Returns a new instance for EntityObjects that provides functionality specific to the user interface

public static DependencyEntityObject Create(EntityObject entityObject, IDataContext context)

Parameters

entityObject EntityObject

The EntityObject to wrap.

context IDataContext

An instance of DataContext to work on.

Returns

DependencyEntityObject

An instance of DependencyEntityObject wrapping an instance of EntityObject.

GetMember(String)

Gets the value of the specified member.

public override object GetMember(string name)

Parameters

name String

Name of the member.

Returns

Object

Returns the value of the specified member.

Remarks

This method also returns the clr properties '{ModelEntityName}Uuid' and 'IsReadOnly' of an EntityObject.

GetMemberAccessPermissions<T>()

Gets the member access permissions.

public MemberAccessPermissions GetMemberAccessPermissions<T>()
    where T : MemberAccessPermissions

Returns

MemberAccessPermissions

An instance of MemberAccessPermissions or an inherited class.

Type Parameters

T

Either MemberAccessPermissions or a derived type.

MergeFrom(EntityObject)

Merges the specified entity object into the current instance of DependencyEntityObject.

public void MergeFrom(EntityObject entityObject)

Parameters

entityObject EntityObject

The entity object.

OnPropertyChanged(String)

Invoked whenever the value of any property on this object has been updated. The specific property that changed is reported in the event data.

protected virtual void OnPropertyChanged(string propertyName)

Parameters

propertyName String

Name of the property that has been updated.

Remarks

This method sets a property in the values collection of an EntityObject to MemberStatus.Changed. Each call of the method calls OnPropertyChanged(String) for the clr properties 'IsChanged', 'Me', 'IsReadonly'.

ReceiveWeakEvent(Type, Object, EventArgs)

Receives events from the centralized event manager.

public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e)

Parameters

managerType Type

The type of the WeakEventManager calling this method.

sender Object

Object that originated the event.

e EventArgs

Event data.

Returns

Boolean

true if the listener handled the event. It is considered an error by the WeakEventManager handling in WPF to register a listener for an event that the listener does not handle. Regardless, the method should return false if it receives an event that it does not recognize or handle.

SetMember(String, Object)

Sets a dynamic member.

public override void SetMember(string name, object value)

Parameters

name String

Name of the member to set.

value Object

Value to set.

Events

PropertyChanged

Occurs when a property value changes.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler