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
-
ObjectDependencyEntityObject
- Implements
-
IDynamicMetaObjectProviderINotifyPropertyChangedIDataErrorInfoIWeakEventListener
- 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
EntityObject
Gets or sets the underlying EntityObject.
public EntityObject EntityObject { get; set; }
Property Value
Error
Gets an error message indicating why validation fails for this object.
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
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
MemberAccessPermissionsInternal
Gets or sets the member access permissions.
protected MemberAccessPermissions MemberAccessPermissionsInternal { get; set; }
Property Value
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
entityObjectEntityObjectThe EntityObject to wrap.
contextIDataContextAn 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
nameStringName 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
TEither MemberAccessPermissions or a derived type.
MergeFrom(EntityObject)
Merges the specified entity object into the current instance of DependencyEntityObject.
public void MergeFrom(EntityObject entityObject)
Parameters
entityObjectEntityObjectThe 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
propertyNameStringName 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
managerTypeTypeThe type of the WeakEventManager calling this method.
senderObjectObject that originated the event.
eEventArgsEvent 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
nameStringName of the member to set.
valueObjectValue to set.
Events
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler PropertyChanged
Event Type
- PropertyChangedEventHandler