C# Class Habanero.Smooth.OneToOneAutoMapper

Conventions 1) If no single reverse relationship and no Attribute is found then it is assumed that relationship is a M:1 i.e. its rev is a 1:M 2) If no single rev rel and 1:1Attribute with no RevRelName then RevRelName = ClassName 3) If no single rev rel and 1:1Att with RevRelName then RevRelName = DeclaredRevRelName 4) If has single rev rel then RevRelName = foundRevRelationshipName Determing RelatedProps if ownerClass.HasProp(RelName+ID) and relatedClass.NotHasProp(RevRelName+ID) owningBOHasForeignKey = true; ownerProp = foundOwnerPropName relatedProp = RelatedClass.ID. if relatedClass.HasProp(reverseRel+ID) and ownerClass.NotHasProp(RelName+ID) owningBOHasForeignKey = false; ownerProp = OwnerClass.Id relatedProp = foundRelatedPropName if ownerClass.HasProp(RelName+ID) and relatedClass.HasProp(RevRelName+ID) if(RelName == relatedClassName) owningBOHasForeignKey = true; ownerProp = foundOwnerClassId relatedProp = foundRelatedPropName Else if ownerClassName LT relatedClassName owningBOHasForeignKey = false; ownerProp = OwnerClassId relatedProp = reverseRelationshipName+ID Else owningBOHasForeignKey = true; ownerProp = RelationshipName+ID relatedProp = RelatedClass.ID
Afficher le fichier Open project: Chillisoft/habanero.smooth Class Usage Examples

Private Properties

Свойство Type Description
CheckReverseRelationshipValid void
FKFoundOnOwnerClass bool
FKFoundOnRelatedClass bool
GetDeleteAction DeleteParentAction
GetFkPropName string
IsDefinedAsAssociation bool
IsDefinedAsCompositionOrAggregation bool
IsDefinedAsCompositionOrAggregation bool
OwnerClassNameGTRelatedClassName bool
ReverseRelationshipIsDefinedAsAggregationOrComposition bool
SetRelationshipType void

Méthodes publiques

Méthode Description
CreateRelPropDef ( ) : IRelPropDef

Create a RelPropDef based on the OwningPrropName and the RelatedPropName.

GetOwningPropName ( ) : string

Using a set of heuristics the Owning Property Name is determined from the RelationshipName and any attributes on the Property. I.e. The Property of the class that owns this One To One Relationship. I.e. The Property on the Class that owns the Property that wrapped by the PropertyWrapper.

GetRelatedPropName ( ) : string

Using a set of heuristics the Related Property Name is determined from the RelationshipName and any attributes on the Property. I.e. The Property of the class that is related by One To One Relationship. I.e. The Property on the Class that is returned by the Property that is wrapped by the PropertyWrapper.

MapOneToOne ( ) : IRelationshipDef

Maps the ReflectionWrappers.PropertyWrapper to a IRelationshipDef.

MustBeMapped ( ) : bool

Determines based on heuristics whether the Property wrapped by the ReflectionWrappers.PropertyWrapper must be mapped to a One to One Relationship or not

OneToOneAutoMapper ( PropertyWrapper propWrap ) : System

Construct a One to One Relationship mapper.

Private Methods

Méthode Description
CheckReverseRelationshipValid ( ) : void
FKFoundOnOwnerClass ( ) : bool
FKFoundOnRelatedClass ( ) : bool
GetDeleteAction ( ) : DeleteParentAction
GetFkPropName ( string relationshipName ) : string
IsDefinedAsAssociation ( ) : bool

If this relationship is defined (I.e. defined via an attribute) as Association then return true.

IsDefinedAsCompositionOrAggregation ( ) : bool
IsDefinedAsCompositionOrAggregation ( PropertyWrapper propertyWrapper ) : bool

If the propertyWrapper is defined as Composition or Aggregation via attributes then return true.

OwnerClassNameGTRelatedClassName ( TypeWrapper ownerClassType, TypeWrapper relatedClassType ) : bool
ReverseRelationshipIsDefinedAsAggregationOrComposition ( ) : bool

If the reverse relationship is defined as Composition or Aggregation via attributes then return true.

SetRelationshipType ( SingleRelationshipDef relDef ) : void

Method Details

CreateRelPropDef() public méthode

Create a RelPropDef based on the OwningPrropName and the RelatedPropName.
public CreateRelPropDef ( ) : IRelPropDef
Résultat IRelPropDef

GetOwningPropName() public méthode

Using a set of heuristics the Owning Property Name is determined from the RelationshipName and any attributes on the Property. I.e. The Property of the class that owns this One To One Relationship. I.e. The Property on the Class that owns the Property that wrapped by the PropertyWrapper.
public GetOwningPropName ( ) : string
Résultat string

GetRelatedPropName() public méthode

Using a set of heuristics the Related Property Name is determined from the RelationshipName and any attributes on the Property. I.e. The Property of the class that is related by One To One Relationship. I.e. The Property on the Class that is returned by the Property that is wrapped by the PropertyWrapper.
public GetRelatedPropName ( ) : string
Résultat string

MapOneToOne() public méthode

Maps the ReflectionWrappers.PropertyWrapper to a IRelationshipDef.
public MapOneToOne ( ) : IRelationshipDef
Résultat IRelationshipDef

MustBeMapped() public méthode

Determines based on heuristics whether the Property wrapped by the ReflectionWrappers.PropertyWrapper must be mapped to a One to One Relationship or not
public MustBeMapped ( ) : bool
Résultat bool

OneToOneAutoMapper() public méthode

Construct a One to One Relationship mapper.
public OneToOneAutoMapper ( PropertyWrapper propWrap ) : System
propWrap PropertyWrapper
Résultat System