Class DependencyEntityObject
A wrapper for entity objects, that implements IDataErrorInfo and throws notifications.
Implements
Inherited Members
Namespace: TimeCockpit.Data
Assembly: TimeCockpit.Data.dll
Syntax
public class DependencyEntityObject : DynamicObject, IDynamicMetaObjectProvider, INotifyPropertyChanged, IEntityObject, IDataErrorInfo, IWeakEventListener
Constructors
DependencyEntityObject()
Initializes a new instance of the DependencyEntityObject class.
Declaration
public DependencyEntityObject()
Properties
DataContext
Gets or sets the data context to evaluate permissions
Declaration
public IDataContext DataContext { get; set; }
Property Value
| Type | Description |
|---|---|
| IDataContext |
EntityObject
Gets or sets the underlying EntityObject.
Declaration
public EntityObject EntityObject { get; set; }
Property Value
| Type | Description |
|---|---|
| EntityObject |
Error
Gets an error message indicating why validation fails for this object.
Declaration
public string Error { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
IsValid
Gets a value indicating whether the EntityObject is valid or not.
Declaration
public bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Me
Gets the it self
Declaration
public EntityObject Me { get; }
Property Value
| Type | Description |
|---|---|
| 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.
Declaration
public virtual MemberAccessPermissions MemberAccessPermissions { get; }
Property Value
| Type | Description |
|---|---|
| MemberAccessPermissions |
MemberAccessPermissionsInternal
Gets or sets the member access permissions.
Declaration
protected MemberAccessPermissions MemberAccessPermissionsInternal { get; set; }
Property Value
| Type | Description |
|---|---|
| MemberAccessPermissions |
MemberAccessPermissionsLock
Gets the member access permissions lock.
Declaration
protected object MemberAccessPermissionsLock { get; }
Property Value
| Type | Description |
|---|---|
| System.Object |
ModelEntityName
Gets the name of the current instance of EntityObject
Declaration
public string ModelEntityName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Implements
ObjectUuid
Gets the unique id of the object.
Declaration
public Guid ObjectUuid { get; }
Property Value
| Type | Description |
|---|---|
| System.Guid |
Implements
Methods
Create(EntityObject, IDataContext)
Returns a new instance for EntityObjects that provides functionality specific to the user interface
Declaration
public static DependencyEntityObject Create(EntityObject entityObject, IDataContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityObject | entityObject | The EntityObject to wrap. |
| IDataContext | context | An instance of DataContext to work on. |
Returns
| Type | Description |
|---|---|
| DependencyEntityObject | An instance of DependencyEntityObject wrapping an instance of EntityObject. |
GetMember(String)
Gets the value of the specified member.
Declaration
public override object GetMember(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the member. |
Returns
| Type | Description |
|---|---|
| System.Object | Returns the value of the specified member. |
Overrides
Remarks
This method also returns the clr properties '{ModelEntityName}Uuid' and 'IsReadOnly' of an EntityObject.
GetMemberAccessPermissions<T>()
Gets the member access permissions.
Declaration
public MemberAccessPermissions GetMemberAccessPermissions<T>()
where T : MemberAccessPermissions
Returns
| Type | Description |
|---|---|
| MemberAccessPermissions | An instance of MemberAccessPermissions or an inherited class. |
Type Parameters
| Name | Description |
|---|---|
| T | Either MemberAccessPermissions or a derived type. |
MergeFrom(EntityObject)
Merges the specified entity object into the current instance of DependencyEntityObject.
Declaration
public void MergeFrom(EntityObject entityObject)
Parameters
| Type | Name | Description |
|---|---|---|
| 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.
Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | propertyName | 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.
Declaration
public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | managerType | The type of the WeakEventManager calling this method. |
| System.Object | sender | Object that originated the event. |
| System.EventArgs | e | Event data. |
Returns
| Type | Description |
|---|---|
| System.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.
Declaration
public override void SetMember(string name, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the member to set. |
| System.Object | value | Value to set. |
Overrides
Events
PropertyChanged
Occurs when a property value changes.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
| Type | Description |
|---|---|
| System.ComponentModel.PropertyChangedEventHandler |