C# Class Castle.ActiveRecord.Framework.Internal.SemanticVerifierVisitor

Traverse the tree checking the semantics of the relation and association. The goal is to raise clear exceptions with tips of how to fix any error. It also tries to infer as much information from the class / attribute model as possible so it can complete the missing information without the user needing to specify it.
Inheritance: AbstractDepthFirstVisitor
Afficher le fichier Open project: nats/castle-1.0.3-mono Class Usage Examples

Méthodes publiques

Méthode Description
GetIndexTypeFromDictionary ( Type propertyType ) : Type

Gets the index type of a mapped dictionary.

GetMapTypeFromDictionary ( Type propertyType ) : Type

Gets the index type of a mapped dictionary.

SemanticVerifierVisitor ( ActiveRecordModelCollection arCollection ) : System

Initializes a new instance of the SemanticVerifierVisitor class.

VisitAny ( AnyModel model ) : void

Visits any.

VisitBelongsTo ( BelongsToModel model ) : void

Visits the belongs to.

Infer column name and type Verify that the property is virtual if the class was marked lazy.

VisitCompositePrimaryKey ( CompositeKeyModel model ) : void

Visits the composite primary key.

Validate that the composite key type is implementing GetHashCode() and Equals(), is mark serializable. Validate that the compose key is compose of two or more columns

VisitCompositeUserType ( CompositeUserTypeModel model ) : void

Visits the custom composite user type.

Apply any column prefixes specified

VisitField ( FieldModel model ) : void

Visits the field.

Infer column name and nullablity

VisitHasAndBelongsToMany ( HasAndBelongsToManyModel model ) : void

Visits the has and belongs to many.

Verify that a link table was specified Verify that a key was specified and that it is valid Verify that required information was specified

VisitHasMany ( HasManyModel model ) : void

Visits the has many.

Guess the type of the relation, if not specified explicitly Verify that the assoication is valid on [HasMany] Validate that required information is specified Infer the other side of the assoication and grab require data from it

VisitHasManyToAny ( HasManyToAnyModel model ) : void

Visit the has many to any

VisitKey ( KeyModel model ) : void

Visits the key.

Infer column name

VisitModel ( ActiveRecordModel model ) : void

Visits the model.

Check that the model: - Define only a discriminator or a join subclass, not both - Doesn't specify version/timestamp property on a joined subclass / discriminator subclass - Validate that the custom entity persister implements IEntityPersister - Validate the joined subclasses has a [JoinedKey] to map back to the parent table - Validate that the class has a PK

VisitNested ( Castle.ActiveRecord.Framework.Internal.NestedModel model ) : void

Visits the nested model

Infer the column name and applies and column prefixes specified

VisitOneToOne ( Castle.ActiveRecord.Framework.Internal.OneToOneModel model ) : void

Visits the one to one.

Infer the type on the other side

VisitPrimaryKey ( PrimaryKeyModel model ) : void

Visits the primary key.

Infer column name and the reverse property if using [OneToOne]

VisitProperty ( PropertyModel model ) : void

Visits the property.

Infer column name and whatever this propery can be null or not Also catch common mistake of try to use [Property] on an entity, instead of [BelongsTo]

VisitTimestamp ( TimestampModel model ) : void

Visits the timestamp.

Infer column name

VisitVersion ( VersionModel model ) : void

Visits the version.

Infer column name

Private Methods

Méthode Description
AssertHasValidKey ( ActiveRecordModel model ) : void
GuessRelation ( PropertyInfo property, RelationType type ) : RelationType
ObtainNullableTypeNameForCLRNullable ( Type type ) : String

Method Details

GetIndexTypeFromDictionary() public static méthode

Gets the index type of a mapped dictionary.
public static GetIndexTypeFromDictionary ( Type propertyType ) : Type
propertyType System.Type Type of the property.
Résultat System.Type

GetMapTypeFromDictionary() public static méthode

Gets the index type of a mapped dictionary.
public static GetMapTypeFromDictionary ( Type propertyType ) : Type
propertyType System.Type Type of the property.
Résultat System.Type

SemanticVerifierVisitor() public méthode

Initializes a new instance of the SemanticVerifierVisitor class.
public SemanticVerifierVisitor ( ActiveRecordModelCollection arCollection ) : System
arCollection ActiveRecordModelCollection The ar collection.
Résultat System

VisitAny() public méthode

Visits any.
public VisitAny ( AnyModel model ) : void
model AnyModel The model.
Résultat void

VisitBelongsTo() public méthode

Visits the belongs to.
Infer column name and type Verify that the property is virtual if the class was marked lazy.
public VisitBelongsTo ( BelongsToModel model ) : void
model BelongsToModel The model.
Résultat void

VisitCompositePrimaryKey() public méthode

Visits the composite primary key.
Validate that the composite key type is implementing GetHashCode() and Equals(), is mark serializable. Validate that the compose key is compose of two or more columns
public VisitCompositePrimaryKey ( CompositeKeyModel model ) : void
model CompositeKeyModel The model.
Résultat void

VisitCompositeUserType() public méthode

Visits the custom composite user type.
Apply any column prefixes specified
public VisitCompositeUserType ( CompositeUserTypeModel model ) : void
model CompositeUserTypeModel The model.
Résultat void

VisitField() public méthode

Visits the field.
Infer column name and nullablity
public VisitField ( FieldModel model ) : void
model FieldModel The model.
Résultat void

VisitHasAndBelongsToMany() public méthode

Visits the has and belongs to many.
Verify that a link table was specified Verify that a key was specified and that it is valid Verify that required information was specified
public VisitHasAndBelongsToMany ( HasAndBelongsToManyModel model ) : void
model HasAndBelongsToManyModel The model.
Résultat void

VisitHasMany() public méthode

Visits the has many.
Guess the type of the relation, if not specified explicitly Verify that the assoication is valid on [HasMany] Validate that required information is specified Infer the other side of the assoication and grab require data from it
public VisitHasMany ( HasManyModel model ) : void
model HasManyModel The model.
Résultat void

VisitHasManyToAny() public méthode

Visit the has many to any
public VisitHasManyToAny ( HasManyToAnyModel model ) : void
model HasManyToAnyModel The model.
Résultat void

VisitKey() public méthode

Visits the key.
Infer column name
public VisitKey ( KeyModel model ) : void
model KeyModel The model.
Résultat void

VisitModel() public méthode

Visits the model.
Check that the model: - Define only a discriminator or a join subclass, not both - Doesn't specify version/timestamp property on a joined subclass / discriminator subclass - Validate that the custom entity persister implements IEntityPersister - Validate the joined subclasses has a [JoinedKey] to map back to the parent table - Validate that the class has a PK
public VisitModel ( ActiveRecordModel model ) : void
model ActiveRecordModel The model.
Résultat void

VisitNested() public méthode

Visits the nested model
Infer the column name and applies and column prefixes specified
public VisitNested ( Castle.ActiveRecord.Framework.Internal.NestedModel model ) : void
model Castle.ActiveRecord.Framework.Internal.NestedModel The model.
Résultat void

VisitOneToOne() public méthode

Visits the one to one.
Infer the type on the other side
public VisitOneToOne ( Castle.ActiveRecord.Framework.Internal.OneToOneModel model ) : void
model Castle.ActiveRecord.Framework.Internal.OneToOneModel The model.
Résultat void

VisitPrimaryKey() public méthode

Visits the primary key.
Infer column name and the reverse property if using [OneToOne]
public VisitPrimaryKey ( PrimaryKeyModel model ) : void
model PrimaryKeyModel The model.
Résultat void

VisitProperty() public méthode

Visits the property.
Infer column name and whatever this propery can be null or not Also catch common mistake of try to use [Property] on an entity, instead of [BelongsTo]
public VisitProperty ( PropertyModel model ) : void
model PropertyModel The model.
Résultat void

VisitTimestamp() public méthode

Visits the timestamp.
Infer column name
public VisitTimestamp ( TimestampModel model ) : void
model TimestampModel The model.
Résultat void

VisitVersion() public méthode

Visits the version.
Infer column name
public VisitVersion ( VersionModel model ) : void
model VersionModel The model.
Résultat void