C# Class Habanero.BO.BOProp

Stores the values (current Value, DatabaseValue etc) and state (dirty, valid) of a property of a IBusinessObject. Has a reference to the Property Definition PropDef that was used to create it. The Property definition includes property rules and validation functionality. The property of a business object may represent a property such as FirstName, Surname. Typically a IBusinessObject will have a collection of Properties.
Inheritance: IBOProp
ファイルを表示 Open project: Chillisoft/habanero Class Usage Examples

Protected Properties

Property Type Description
_currentValue object
_invalidReason string
_isDirty bool
_isObjectNew bool
_isValid bool
_logger IHabaneroLogger
_origInvalidReason string
_origValueIsValid bool
_persistedValue object
_propDef IPropDef
_valueBeforeLastEdit object

Public Methods

Method Description
BOProp ( IPropDef propDef ) : System

Constructor to initialise a new property

BOProp ( IPropDef propDef, object propValue ) : System

Constructor to initialise a new property with a specific value

BackupPropValue ( ) : void

Copies the current property value to PersistedValue. This is usually called when the object is persisted to the database.

CurrentValueEquals ( object value ) : bool

Is the value equal to the current Value of the BOProp.

InitialiseProp ( object propValue ) : bool

Initialises the property with the specified value

IsEditable ( string &message ) : bool

Returns whether the BOProperty is Editable or not. The BOProp may not be editable based on a number of factors. 1) If its ReadWrite Rules are set to ReadOnly etc. 2) The user may not have permissions to edit this property Value.

IsReadable ( string &message ) : bool

Returns whether the BOProperty is Readable or not. The BOProp may not be Readable if the user may not have permissions to read the property Value.

ParsePropValue ( object valueToParse, object &returnValue ) : void

This method provides a the functionality to convert any object to the appropriate type for the particular BOProp Type. e.g it will convert a valid guid string to a valid Guid Object.

RestorePropValue ( ) : void

Restores the property's original value as defined in PersistedValue

SetAuthorisationRules ( IBOPropAuthorisation boPropAuthorisation ) : void

Set the authorisation rule strategy to be used

Validate ( ) : void

Validates whether the property values set for the BOProp are valid as compared to the BOProp rules. This is used by the Business Object Validate Method.

Protected Methods

Method Description
FireBOPropValueUpdated ( ) : void

Fires an Updated event

InitialiseProp ( object propValue, bool isObjectNew ) : bool

Initialises the property with the specified value, and indicates whether the object is new or not

IsReadable ( ) : bool

Are there any authorisation rules preventing this property from being read.

RaiseIncorrectTypeException ( object value ) : void

Raises an Erorr if the Incorrect type of property is being set to this BOProp.

Private Methods

Method Description
AreReadWriteRulesEditable ( string &message ) : bool
CompareValues ( object compareToValue, object value ) : bool
FormatForXML ( string text ) : string
PersistedValueEquals ( object value ) : bool

Is the value equal to the persisted Value of the BOProp.

Method Details

BOProp() public method

Constructor to initialise a new property
public BOProp ( IPropDef propDef ) : System
propDef IPropDef The property definition
return System

BOProp() public method

Constructor to initialise a new property with a specific value
public BOProp ( IPropDef propDef, object propValue ) : System
propDef IPropDef The property definition
propValue object The initial value
return System

BackupPropValue() public method

Copies the current property value to PersistedValue. This is usually called when the object is persisted to the database.
public BackupPropValue ( ) : void
return void

CurrentValueEquals() public method

Is the value equal to the current Value of the BOProp.
public CurrentValueEquals ( object value ) : bool
value object
return bool

FireBOPropValueUpdated() protected method

Fires an Updated event
protected FireBOPropValueUpdated ( ) : void
return void

InitialiseProp() public method

Initialises the property with the specified value
public InitialiseProp ( object propValue ) : bool
propValue object The value to assign
return bool

InitialiseProp() protected method

Initialises the property with the specified value, and indicates whether the object is new or not
protected InitialiseProp ( object propValue, bool isObjectNew ) : bool
propValue object The value to assign
isObjectNew bool Whether the object is new or not
return bool

IsEditable() public method

Returns whether the BOProperty is Editable or not. The BOProp may not be editable based on a number of factors. 1) If its ReadWrite Rules are set to ReadOnly etc. 2) The user may not have permissions to edit this property Value.
public IsEditable ( string &message ) : bool
message string
return bool

IsReadable() protected method

Are there any authorisation rules preventing this property from being read.
protected IsReadable ( ) : bool
return bool

IsReadable() public method

Returns whether the BOProperty is Readable or not. The BOProp may not be Readable if the user may not have permissions to read the property Value.
public IsReadable ( string &message ) : bool
message string the reason why the user cannot read the property.
return bool

ParsePropValue() public method

This method provides a the functionality to convert any object to the appropriate type for the particular BOProp Type. e.g it will convert a valid guid string to a valid Guid Object.
public ParsePropValue ( object valueToParse, object &returnValue ) : void
valueToParse object The value to be converted
returnValue object The value that has been parsed
return void

RaiseIncorrectTypeException() protected method

Raises an Erorr if the Incorrect type of property is being set to this BOProp.
protected RaiseIncorrectTypeException ( object value ) : void
value object
return void

RestorePropValue() public method

Restores the property's original value as defined in PersistedValue
public RestorePropValue ( ) : void
return void

SetAuthorisationRules() public method

Set the authorisation rule strategy to be used
public SetAuthorisationRules ( IBOPropAuthorisation boPropAuthorisation ) : void
boPropAuthorisation IBOPropAuthorisation
return void

Validate() public method

Validates whether the property values set for the BOProp are valid as compared to the BOProp rules. This is used by the Business Object Validate Method.
public Validate ( ) : void
return void

Property Details

_currentValue protected_oe property

The current value of the BOProp
protected object _currentValue
return object

_invalidReason protected_oe property

The reason the prop is invalid
protected string _invalidReason
return string

_isDirty protected_oe property

Whether the prop has been edited since being created or loaded from the database
protected bool _isDirty
return bool

_isObjectNew protected_oe property

Is the business object new.
protected bool _isObjectNew
return bool

_isValid protected_oe property

Is the boProp valid
protected bool _isValid
return bool

_logger protected_oe static_oe property

The Logger
protected static IHabaneroLogger _logger
return IHabaneroLogger

_origInvalidReason protected_oe property

The reason that the origional value was not valid.
protected string _origInvalidReason
return string

_origValueIsValid protected_oe property

Whether the origional value loaded from the DB or the default value was valid.
protected bool _origValueIsValid
return bool

_persistedValue protected_oe property

The persisted value of the Property.
protected object _persistedValue
return object

_propDef protected_oe property

The propDef for the BOProp
protected IPropDef _propDef
return IPropDef

_valueBeforeLastEdit protected_oe property

The value prior to the last edit.
protected object _valueBeforeLastEdit
return object