C# 클래스 Habanero.BO.ClassDefinition.RelationshipDef

Defines the relationship between the ownming Business Object (IBusinessObject and the related Business Object. This class collaborates with the RelKeyDef, the ClassDef to provide a definition Relationship. This class along with the RelKeyDef and RelPropDef provides an implementation of the Foreign Key Mapping pattern (Fowler (236) - 'Patterns of Enterprise Application Architecture' - 'Maps an association between objects to a foreign Key Reference between tables.') The RelationshipDef should not be used by the Application developer since it is usually constructed based on the mapping in the ClassDef.xml file. The RelationshipDef (Relationship Definition) is used bay a ClassDef to define a particular relationship. Each relationship has a relationship name e.g. A relationship betwee a person and a department may manager, employee etc. The related Class e.g. A Department definition would contain a relationship definition to a Person Class. (to allow for the person class to be in a different assemply the assembly name is also stored. The list of properties the define the Foreign key mapping of relationship between these two classes is stored using the RelKeyDef. The Relationship also stores additional information such as DeleteParentAction and order critieria. The DeleteParentAction defines any constraints that the relationship should provide in the case of the parent (relationship owner e.g. Depertment in our example) being deleted. E.g. If the department (parent) is being deleted you may want to delete all related object or prevent delete if there are any related objects. In cases where there are many related objects e.g. A Department can have many Employees the relationship may be required to load in a specifically order e.g. by employee number. The order criteria is used for this.
상속: IRelationshipDef
파일 보기 프로젝트 열기: Chillisoft/habanero 1 사용 예제들

Private Properties

프로퍼티 타입 설명
RelationshipDef System

공개 메소드들

메소드 설명
CheckCanAddChild ( IBusinessObject bo ) : void

Can the child business object be added to this relationship. Typically a persisted child business object cannot be added to a compositional relationship. A new (i.e. unpersisted) child object can however be.

CheckCanRemoveChild ( IBusinessObject bo ) : void

Checks to see whether a business object can be removed from the relationship. Typically a business object cannot be removed from the relationship if the relationship is composition.

CreateRelationship ( IBusinessObject owningBo, IBOPropCol lBOPropCol ) : IRelationship

Create and return a new Relationship based on the relationship definition.

보호된 메소드들

메소드 설명
RelatedClassDefLoaded ( ) : bool

Returns true if the related class def has been loaded already.

RelationshipDef ( string relationshipName, Type relatedObjectClassType, IRelKeyDef relKeyDef, bool keepReferenceToRelatedObject, DeleteParentAction deleteParentAction ) : System

Constructor to create a new relationship definition

RelationshipDef ( string relationshipName, string relatedObjectAssemblyName, string relatedObjectClassName, IRelKeyDef relKeyDef, bool keepReferenceToRelatedObject, DeleteParentAction deleteParentAction, InsertParentAction insertParentAction, RelationshipType relationshipType ) : System

Constructor to create a new relationship definition

비공개 메소드들

메소드 설명
RelationshipDef ( string relationshipName, Type relatedObjectClassType, string relatedObjectAssemblyName, string relatedObjectClassName, IRelKeyDef relKeyDef, bool keepReferenceToRelatedObject, DeleteParentAction deleteParentAction, InsertParentAction insertParentAction, RelationshipType relationshipType ) : System

메소드 상세

CheckCanAddChild() 공개 메소드

Can the child business object be added to this relationship. Typically a persisted child business object cannot be added to a compositional relationship. A new (i.e. unpersisted) child object can however be.
public CheckCanAddChild ( IBusinessObject bo ) : void
bo IBusinessObject
리턴 void

CheckCanRemoveChild() 공개 메소드

Checks to see whether a business object can be removed from the relationship. Typically a business object cannot be removed from the relationship if the relationship is composition.
public CheckCanRemoveChild ( IBusinessObject bo ) : void
bo IBusinessObject The business object being removed
리턴 void

CreateRelationship() 공개 추상적인 메소드

Create and return a new Relationship based on the relationship definition.
public abstract CreateRelationship ( IBusinessObject owningBo, IBOPropCol lBOPropCol ) : IRelationship
owningBo IBusinessObject The business object that owns /// this relationship e.g. The department
lBOPropCol IBOPropCol The collection of properties of the Business object
리턴 IRelationship

RelatedClassDefLoaded() 보호된 메소드

Returns true if the related class def has been loaded already.
protected RelatedClassDefLoaded ( ) : bool
리턴 bool

RelationshipDef() 보호된 메소드

Constructor to create a new relationship definition
protected RelationshipDef ( string relationshipName, Type relatedObjectClassType, IRelKeyDef relKeyDef, bool keepReferenceToRelatedObject, DeleteParentAction deleteParentAction ) : System
relationshipName string A name for the relationship
relatedObjectClassType Type The class type of the related object
relKeyDef IRelKeyDef The related key definition
keepReferenceToRelatedObject bool Whether to keep a /// reference to the related object. Could be false for memory- /// intensive applications.
deleteParentAction DeleteParentAction The required action when the parent is deleted e.g. Dereference related, delete related, prevent delete
리턴 System

RelationshipDef() 보호된 메소드

Constructor to create a new relationship definition
protected RelationshipDef ( string relationshipName, string relatedObjectAssemblyName, string relatedObjectClassName, IRelKeyDef relKeyDef, bool keepReferenceToRelatedObject, DeleteParentAction deleteParentAction, InsertParentAction insertParentAction, RelationshipType relationshipType ) : System
relationshipName string A name for the relationship
relatedObjectAssemblyName string The assembly that the related object is in
relatedObjectClassName string The class type of the related object
relKeyDef IRelKeyDef The related key definition
keepReferenceToRelatedObject bool Whether to keep a /// reference to the related object. Could be false for memory- /// intensive applications.
deleteParentAction DeleteParentAction The required action when the parent is deleted e.g. Dereference related, delete related, prevent delete
insertParentAction InsertParentAction
relationshipType RelationshipType
리턴 System