C# 클래스 Catel.Data.ModelBase

파일 보기 프로젝트 열기: Catel/Catel 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
IsDirtyProperty PropertyData
IsReadOnlyProperty PropertyData

Private Properties

프로퍼티 타입 설명
CatchUpWithSuspendedAnnotationsValidation void
ClearIsDirtyOnAllChilds void
EnsureValidationIsUpToDate void
FinishInitializationAfterConstructionOrDeserialization void
GetObjectData void
GetValidator IValidator
HandleObjectEventsSubscription void
IEditableObject void
IModelValidation void
INotifyDataErrorInfo IEnumerable
INotifyDataWarningInfo IEnumerable
IXmlSerializable XmlSchema
IXmlSerializable void
IXmlSerializable void
Initialize void
ModelBase System
NotifyErrorsChanged void
NotifyWarningsChanged void
OnDeserialized void
OnValidated void
OnValidatedBusinessRules void
OnValidatedFields void
OnValidating void
OnValidatingBusinessRules void
OnValidatingFields void
RaisePropertyChanged void
RaisePropertyChangedForAllRegisteredProperties void
SetBusinessRuleValidationResult void
SetFieldValidationResult void
ValidatePropertyUsingAnnotations bool
this stringIDataErrorInfo.Runtime.Serialization
this stringIDataWarningInfo.Runtime.Serialization

공개 메소드들

메소드 설명
Equals ( object obj ) : bool

Determines whether the specified System.Object is equal to this instance.

GetHashCode ( ) : int

Returns a hash code for this instance.

SuspendChangeCallbacks ( ) : IDisposable

Suspends the change callbacks whenever a property has been called. This is very useful when there are expensive property change callbacks registered with a property that need to be temporarily disabled.

SuspendChangeNotifications ( bool raiseOnResume = true ) : IDisposable

Suspends the change notifications until the disposed object has been released.

SuspendValidations ( bool validateOnResume = true ) : IDisposable

Suspends the validation until the disposable token has been disposed.

ToString ( ) : string

Returns a System.String that represents this instance.

Validate ( bool force, bool validateDataAnnotations ) : void

Validates the current object for field and business rule errors.

To check whether this object contains any errors, use the INotifyDataErrorInfo.HasErrors property.

operator ( ) : bool

Implements the operator ==.

보호된 메소드들

메소드 설명
ClearIsDirtyOnAllChilds ( ) : void

Clears the IsDirty on all childs.

GetBusinessRuleErrors ( ) : string

Gets the current errors errors.

GetBusinessRuleWarnings ( ) : string

Gets the current business warnings.

GetFieldErrors ( string columnName ) : string

Gets the errors for a specific column.

GetFieldWarnings ( string columnName ) : string

Gets the warnings for a specific column.

InitializeCustomProperties ( ) : void

Allows the initialization of custom properties. This is a virtual method that is called inside the constructor before the object is fully constructed. This might be considered as bad or as a hack, but it's a good way to be able to inject custom properties before any actual logic is handled by derived classes.

Only use when you really know what you are doing.

ModelBase ( SerializationInfo info, StreamingContext context ) : Catel.IoC

Initializes a new instance of the ModelBase class. Only constructor for the ModelBase.

Call this method, even when constructing the object for the first time (thus not deserializing).

NotifyValidationResult ( IValidationResult validationResult, bool notifyGlobal ) : void

Raises the right events based on the validation result.

OnBeginEdit ( System.ComponentModel.BeginEditEventArgs e ) : void

Raises the IEditableObject.BeginEdit event.

OnCancelEdit ( System.ComponentModel.EditEventArgs e ) : void

Raises the IEditableObject.CancelEdit event.

OnCancelEditCompleted ( System.ComponentModel.CancelEditCompletedEventArgs e ) : void

Raises the IAdvancedEditableObject.CancelEditingCompleted event.

OnEndEdit ( System.ComponentModel.EditEventArgs e ) : void

Raises the IEditableObject.EndEdit event.

OnInitialized ( ) : void

Called when the object is initialized.

OnInitializing ( ) : void

Called when the object is being initialized.

OnPropertyObjectCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void

Called when a property that implements INotifyCollectionChanged raises the event.

OnPropertyObjectCollectionItemPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Called when a property inside a collection that implements INotifyCollectionChanged that implements INotifyPropertyChanged raises the event.

OnPropertyObjectPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Called when a property that implements INotifyPropertyChanged raises the event.

OnValidated ( IValidationContext validationContext ) : void

Called when the object is validated.

OnValidatedBusinessRules ( IValidationContext validationContext ) : void

Called when the object has validated the business rules.

OnValidatedFields ( IValidationContext validationContext ) : void

Called when the object has validated the fields.

OnValidating ( IValidationContext validationContext ) : void

Called when the object is validating.

OnValidatingBusinessRules ( IValidationContext validationContext ) : void

Called when the object is validating the business rules.

OnValidatingFields ( IValidationContext validationContext ) : void

Called when the object is validating the fields.

RaisePropertyChanged ( object sender, Catel.Data.AdvancedPropertyChangedEventArgs e ) : void

Raises the INotifyPropertyChanged.PropertyChanged event.

This method is overriden en does not call the base because lots of additional logic is added in this class. The RaisePropertyChanged(object,System.ComponentModel.PropertyChangedEventArgs,bool,bool) will explicitly call ObservableObject.RaisePropertyChanged(object, AdvancedPropertyChangedEventArgs). If this method is overriden, it is very important to call the base.

SetDirtyAndAutomaticallyValidate ( string propertyName, bool setDirtyAndAllowAutomaticValidation ) : void

Sets the IsDirty property and automatically validate if required.

SetParent ( IParent parent ) : void

Sets the new parent of this object.

ShouldPropertyChangeUpdateIsDirty ( string propertyName ) : bool

Determines whether a specific property change should update IsDirty to true.

Validate ( bool force = false ) : void

Validates the current object for field and business rule errors.

To check whether this object contains any errors, use the INotifyDataErrorInfo.HasErrors property.

ValidateBusinessRules ( List validationResults ) : void

Validates the business rules of this object. Override this method to enable validation of business rules.

ValidateFields ( List validationResults ) : void

Validates the field values of this object. Override this method to enable validation of field values.

비공개 메소드들

메소드 설명
CatchUpWithSuspendedAnnotationsValidation ( ) : void

Catches up with suspended annotations validation. This method will take care of unvalidated properties that have been changed during the suspended validation state of this model.

ClearIsDirtyOnAllChilds ( object obj, HashSet handledReferences ) : void

Clears the IsDirty on all childs.

EnsureValidationIsUpToDate ( bool constraint = true ) : void

Ensures the validation is up to date.

FinishInitializationAfterConstructionOrDeserialization ( ) : void

Finishes the initialization after construction or deserialization.

GetObjectData ( SerializationInfo info, StreamingContext context ) : void
GetValidator ( ) : IValidator

Gets the validator. If the field is null, it will query the service locator.

HandleObjectEventsSubscription ( string propertyName, object propertyValue ) : void

Handles the object events subscription. This means that the old value will be removed from the event subscriptions, and the new value will be subscribed to.

IEditableObject ( ) : void

Begins an edit on an object.

IModelValidation ( bool force ) : void

Validates the current object for field and business rule errors.

To check whether this object contains any errors, use the INotifyDataErrorInfo.HasErrors property.

INotifyDataErrorInfo ( string propertyName ) : IEnumerable

Gets the validation errors for a specified property or for the entire object.

INotifyDataWarningInfo ( string propertyName ) : IEnumerable

Gets the warnings for the specific property name.

IXmlSerializable ( ) : XmlSchema

This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the T:System.Xml.Serialization.XmlSchemaProviderAttribute to the class.

IXmlSerializable ( XmlReader reader ) : void

Generates an object from its XML representation.

IXmlSerializable ( XmlWriter writer ) : void

Converts an object into its XML representation.

Initialize ( ) : void

Initializes the object by setting default values.

ModelBase ( ) : System

Initializes static members of the ModelBase class.

NotifyErrorsChanged ( string propertyName, bool notifyHasErrors ) : void

Notifies all listeners that the errors for the specified property have changed. If the propertyName is null or string.Empty, the business errors will be updated.

NotifyWarningsChanged ( string propertyName, bool notifyHasWarnings ) : void

Notifies all listeners that the warnings for the specified property have changed. If the propertyName is null or string.Empty, the business errors will be updated.

OnDeserialized ( StreamingContext context ) : void
OnValidated ( ) : void
OnValidatedBusinessRules ( ) : void
OnValidatedFields ( ) : void
OnValidating ( ) : void
OnValidatingBusinessRules ( ) : void
OnValidatingFields ( ) : void
RaisePropertyChanged ( object sender, PropertyChangedEventArgs e, bool setDirtyAndAllowAutomaticValidation, bool isRefreshCallOnly ) : void

Invoked when a property value has changed.

RaisePropertyChangedForAllRegisteredProperties ( ) : void

Invokes the property changed for all registered properties.

Using this method does not set the IsDirty property to true, nor will it cause the object to validate itself automatically, even when the AutomaticallyValidateOnPropertyChanged is set to true.

SetBusinessRuleValidationResult ( IBusinessRuleValidationResult validationResult ) : void
SetFieldValidationResult ( IFieldValidationResult validationResult ) : void
ValidatePropertyUsingAnnotations ( string propertyName, object value, PropertyData catelPropertyData ) : bool

Validates the property using data annotations.

this ( string columnName ) : stringIDataErrorInfo.Runtime.Serialization

Gets an error for a specific column.

this ( string columnName ) : stringIDataWarningInfo.Runtime.Serialization

Gets a warning for a specific column.

메소드 상세

ClearIsDirtyOnAllChilds() 보호된 메소드

Clears the IsDirty on all childs.
protected ClearIsDirtyOnAllChilds ( ) : void
리턴 void

Equals() 공개 메소드

Determines whether the specified System.Object is equal to this instance.
/// The parameter is null. ///
public Equals ( object obj ) : bool
obj object The to compare with this instance.
리턴 bool

GetBusinessRuleErrors() 보호된 메소드

Gets the current errors errors.
protected GetBusinessRuleErrors ( ) : string
리턴 string

GetBusinessRuleWarnings() 보호된 메소드

Gets the current business warnings.
protected GetBusinessRuleWarnings ( ) : string
리턴 string

GetFieldErrors() 보호된 메소드

Gets the errors for a specific column.
protected GetFieldErrors ( string columnName ) : string
columnName string Column name.
리턴 string

GetFieldWarnings() 보호된 메소드

Gets the warnings for a specific column.
protected GetFieldWarnings ( string columnName ) : string
columnName string Column name.
리턴 string

GetHashCode() 공개 메소드

Returns a hash code for this instance.
public GetHashCode ( ) : int
리턴 int

InitializeCustomProperties() 보호된 메소드

Allows the initialization of custom properties. This is a virtual method that is called inside the constructor before the object is fully constructed. This might be considered as bad or as a hack, but it's a good way to be able to inject custom properties before any actual logic is handled by derived classes.
Only use when you really know what you are doing.
protected InitializeCustomProperties ( ) : void
리턴 void

ModelBase() 보호된 메소드

Initializes a new instance of the ModelBase class. Only constructor for the ModelBase.
Call this method, even when constructing the object for the first time (thus not deserializing).
protected ModelBase ( SerializationInfo info, StreamingContext context ) : Catel.IoC
info SerializationInfo SerializationInfo object, null if this is the first time construction.
context StreamingContext StreamingContext object, simple pass a default new StreamingContext() if this is the first time construction.
리턴 Catel.IoC

NotifyValidationResult() 보호된 메소드

Raises the right events based on the validation result.
The is null.
protected NotifyValidationResult ( IValidationResult validationResult, bool notifyGlobal ) : void
validationResult IValidationResult The validation result.
notifyGlobal bool If set to true, the global properties such as and are also raised.
리턴 void

OnBeginEdit() 보호된 메소드

Raises the IEditableObject.BeginEdit event.
protected OnBeginEdit ( System.ComponentModel.BeginEditEventArgs e ) : void
e System.ComponentModel.BeginEditEventArgs The instance containing the event data.
리턴 void

OnCancelEdit() 보호된 메소드

Raises the IEditableObject.CancelEdit event.
protected OnCancelEdit ( System.ComponentModel.EditEventArgs e ) : void
e System.ComponentModel.EditEventArgs The instance containing the event data.
리턴 void

OnCancelEditCompleted() 보호된 메소드

Raises the IAdvancedEditableObject.CancelEditingCompleted event.
protected OnCancelEditCompleted ( System.ComponentModel.CancelEditCompletedEventArgs e ) : void
e System.ComponentModel.CancelEditCompletedEventArgs The instance containing the event data.
리턴 void

OnEndEdit() 보호된 메소드

Raises the IEditableObject.EndEdit event.
protected OnEndEdit ( System.ComponentModel.EditEventArgs e ) : void
e System.ComponentModel.EditEventArgs The instance containing the event data.
리턴 void

OnInitialized() 보호된 메소드

Called when the object is initialized.
protected OnInitialized ( ) : void
리턴 void

OnInitializing() 보호된 메소드

Called when the object is being initialized.
protected OnInitializing ( ) : void
리턴 void

OnPropertyObjectCollectionChanged() 보호된 메소드

Called when a property that implements INotifyCollectionChanged raises the event.
protected OnPropertyObjectCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void
sender object The sender.
e NotifyCollectionChangedEventArgs The instance containing the event data.
리턴 void

OnPropertyObjectCollectionItemPropertyChanged() 보호된 메소드

Called when a property inside a collection that implements INotifyCollectionChanged that implements INotifyPropertyChanged raises the event.
protected OnPropertyObjectCollectionItemPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void
sender object The sender.
e System.ComponentModel.PropertyChangedEventArgs The instance containing the event data.
리턴 void

OnPropertyObjectPropertyChanged() 보호된 메소드

Called when a property that implements INotifyPropertyChanged raises the event.
protected OnPropertyObjectPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void
sender object The sender.
e System.ComponentModel.PropertyChangedEventArgs The instance containing the event data.
리턴 void

OnValidated() 보호된 메소드

Called when the object is validated.
protected OnValidated ( IValidationContext validationContext ) : void
validationContext IValidationContext The validation context.
리턴 void

OnValidatedBusinessRules() 보호된 메소드

Called when the object has validated the business rules.
protected OnValidatedBusinessRules ( IValidationContext validationContext ) : void
validationContext IValidationContext The validation context.
리턴 void

OnValidatedFields() 보호된 메소드

Called when the object has validated the fields.
protected OnValidatedFields ( IValidationContext validationContext ) : void
validationContext IValidationContext The validation context.
리턴 void

OnValidating() 보호된 메소드

Called when the object is validating.
protected OnValidating ( IValidationContext validationContext ) : void
validationContext IValidationContext The validation context.
리턴 void

OnValidatingBusinessRules() 보호된 메소드

Called when the object is validating the business rules.
protected OnValidatingBusinessRules ( IValidationContext validationContext ) : void
validationContext IValidationContext The validation context.
리턴 void

OnValidatingFields() 보호된 메소드

Called when the object is validating the fields.
protected OnValidatingFields ( IValidationContext validationContext ) : void
validationContext IValidationContext The validation context.
리턴 void

RaisePropertyChanged() 보호된 메소드

Raises the INotifyPropertyChanged.PropertyChanged event.
This method is overriden en does not call the base because lots of additional logic is added in this class. The RaisePropertyChanged(object,System.ComponentModel.PropertyChangedEventArgs,bool,bool) will explicitly call ObservableObject.RaisePropertyChanged(object, AdvancedPropertyChangedEventArgs). If this method is overriden, it is very important to call the base.
protected RaisePropertyChanged ( object sender, Catel.Data.AdvancedPropertyChangedEventArgs e ) : void
sender object The sender.
e Catel.Data.AdvancedPropertyChangedEventArgs The instance containing the event data.
리턴 void

SetDirtyAndAutomaticallyValidate() 보호된 메소드

Sets the IsDirty property and automatically validate if required.
protected SetDirtyAndAutomaticallyValidate ( string propertyName, bool setDirtyAndAllowAutomaticValidation ) : void
propertyName string Name of the property.
setDirtyAndAllowAutomaticValidation bool If set to true, the property is set and automatic validation is allowed.
리턴 void

SetParent() 보호된 메소드

Sets the new parent of this object.
protected SetParent ( IParent parent ) : void
parent IParent The new parent.
리턴 void

ShouldPropertyChangeUpdateIsDirty() 보호된 메소드

Determines whether a specific property change should update IsDirty to true.
protected ShouldPropertyChangeUpdateIsDirty ( string propertyName ) : bool
propertyName string
리턴 bool

SuspendChangeCallbacks() 공개 메소드

Suspends the change callbacks whenever a property has been called. This is very useful when there are expensive property change callbacks registered with a property that need to be temporarily disabled.
public SuspendChangeCallbacks ( ) : IDisposable
리턴 IDisposable

SuspendChangeNotifications() 공개 메소드

Suspends the change notifications until the disposed object has been released.
public SuspendChangeNotifications ( bool raiseOnResume = true ) : IDisposable
raiseOnResume bool if set to true, the notifications are invoked on resume.
리턴 IDisposable

SuspendValidations() 공개 메소드

Suspends the validation until the disposable token has been disposed.
public SuspendValidations ( bool validateOnResume = true ) : IDisposable
validateOnResume bool
리턴 IDisposable

ToString() 공개 메소드

Returns a System.String that represents this instance.
public ToString ( ) : string
리턴 string

Validate() 보호된 메소드

Validates the current object for field and business rule errors.
To check whether this object contains any errors, use the INotifyDataErrorInfo.HasErrors property.
protected Validate ( bool force = false ) : void
force bool If set to true, a validation is forced. When the validation is not forced, it means /// that when the object is already validated, and no properties have been changed, no validation actually occurs /// since there is no reason for any values to have changed. ///
리턴 void

Validate() 공개 메소드

Validates the current object for field and business rule errors.
To check whether this object contains any errors, use the INotifyDataErrorInfo.HasErrors property.
public Validate ( bool force, bool validateDataAnnotations ) : void
force bool If set to true, a validation is forced (even if the object knows it is already validated).
validateDataAnnotations bool If set to true, the data annotations will be checked. This value is only used if is set to true.
리턴 void

ValidateBusinessRules() 보호된 메소드

Validates the business rules of this object. Override this method to enable validation of business rules.
protected ValidateBusinessRules ( List validationResults ) : void
validationResults List The validation results, add additional results to this list.
리턴 void

ValidateFields() 보호된 메소드

Validates the field values of this object. Override this method to enable validation of field values.
protected ValidateFields ( List validationResults ) : void
validationResults List The validation results, add additional results to this list.
리턴 void

operator() 공개 정적인 메소드

Implements the operator ==.
public static operator ( ) : bool
리턴 bool

프로퍼티 상세

IsDirtyProperty 공개적으로 정적으로 프로퍼티

Register the IsDirty property so it is known in the class.
public static PropertyData IsDirtyProperty
리턴 PropertyData

IsReadOnlyProperty 공개적으로 정적으로 프로퍼티

Register the IsReadOnly property so it is known in the class.
public static PropertyData IsReadOnlyProperty
리턴 PropertyData