C# Class EFUtility.CodeGenerationTools.MetadataTools

Responsible for making the Entity Framework Metadata more accessible for code generation.
Afficher le fichier Open project: jradxl/Entity-Framework-Code-Generation-Tools-Experiments Class Usage Examples

Méthodes publiques

Méthode Description
ClrType ( TypeUsage typeUsage ) : Type

This method returns the underlying CLR type of the o-space type corresponding to the supplied typeUsage Note that for an enum type this means that the type backing the enum will be returned, not the enum type itself.

GetCorrespondingDependentProperty ( System.Data.Metadata.Edm.NavigationProperty navProperty, System.Data.Metadata.Edm.EdmProperty principalProperty ) : System.Data.Metadata.Edm.EdmProperty

Given a property on the principal end of a referential constraint, returns the corresponding property on the dependent end. Requires: The association has a referential constraint, and the specified principalProperty is one of the properties on the principal end.

GetCorrespondingPrincipalProperty ( System.Data.Metadata.Edm.NavigationProperty navProperty, System.Data.Metadata.Edm.EdmProperty dependentProperty ) : System.Data.Metadata.Edm.EdmProperty

Given a property on the dependent end of a referential constraint, returns the corresponding property on the principal end. Requires: The association has a referential constraint, and the specified dependentProperty is one of the properties on the dependent end.

GetDependentProperties ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : ReadOnlyMetadataCollection

Gets the collection of properties that are on the dependent end of a referential constraint for the specified navigation property. Requires: The association has a referential constraint.

GetElementType ( TypeUsage typeUsage ) : TypeUsage

If the passed in TypeUsage represents a collection this method returns final element type of the collection, otherwise it returns the value passed in.

GetPrincipalProperties ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : ReadOnlyMetadataCollection

Gets the collection of properties that are on the principal end of a referential constraint for the specified navigation property. Requires: The association has a referential constraint.

GetSubtypesOf ( EntityType type, ItemCollection itemCollection, bool includeAbstractTypes ) : IEnumerable

Returns the subtype of the EntityType in the current itemCollection

Inverse ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : System.Data.Metadata.Edm.NavigationProperty

Returns the NavigationProperty that is the other end of the same association set if it is available, otherwise it returns null.

IsCascadeDeletePrincipal ( System.Data.Metadata.Edm.AssociationEndMember associationEnd ) : bool

True if the specified association end is the principal in an identifying relationship. or if the association end has cascade delete defined.

IsCascadeDeletePrincipal ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : bool

True if the source end of the specified navigation property is the principal in an identifying relationship. or if the source end has cascade delete defined.

IsIdentifyingRelationship ( System.Data.Metadata.Edm.AssociationType association ) : bool

True if the specified association type is an identifying relationship. In order to be an identifying relationship, the association must have a referential constraint where all of the dependent properties are part of the dependent type's primary key.

IsKey ( System.Data.Metadata.Edm.EdmProperty property ) : bool

True if the EdmProperty is a key of its DeclaringType, False otherwise.

IsNullable ( System.Data.Metadata.Edm.EdmProperty property ) : bool

True if the EdmProperty TypeUsage is Nullable, False otherwise.

IsNullable ( TypeUsage typeUsage ) : bool

True if the TypeUsage is Nullable, False otherwise.

IsPrincipalEndOfIdentifyingRelationship ( System.Data.Metadata.Edm.AssociationEndMember associationEnd ) : bool

True if the specified association end is the principal end in an identifying relationship. In order to be an identifying relationship, the association must have a referential constraint where all of the dependent properties are part of the dependent type's primary key.

IsSubtypeOf ( System.Data.Metadata.Edm.EdmType firstType, System.Data.Metadata.Edm.EdmType secondType ) : bool

requires: firstType is not null effects: if secondType is among the base types of the firstType, return true, otherwise returns false. when firstType is same as the secondType, return false.

MetadataTools ( object textTransformation ) : System

Initializes an MetadataTools Instance with the TextTransformation (T4 generated class) that is currently running

NeedsHandleCascadeDeleteMethod ( ItemCollection itemCollection, EntityType entity ) : bool

True if this entity type requires the HandleCascadeDelete method defined and the method has not been defined on any base type

TryGetStringMetadataPropertySetting ( System.Data.Metadata.Edm.MetadataItem item, string propertyName, string &value ) : bool
UnderlyingClrType ( System.Data.Metadata.Edm.EdmType edmType ) : Type

This method returns the underlying CLR type given the c-space type. Note that for an enum type this means that the type backing the enum will be returned, not the enum type itself.

Private Methods

Méthode Description
ContainsCascadeDeleteAssociation ( ItemCollection itemCollection, EntityType entity ) : bool

True if this entity type participates in any relationships where the other end has an OnDelete cascade delete defined, or if it is the dependent in any identifying relationships

Method Details

ClrType() public méthode

This method returns the underlying CLR type of the o-space type corresponding to the supplied typeUsage Note that for an enum type this means that the type backing the enum will be returned, not the enum type itself.
public ClrType ( TypeUsage typeUsage ) : Type
typeUsage TypeUsage
Résultat System.Type

GetCorrespondingDependentProperty() public méthode

Given a property on the principal end of a referential constraint, returns the corresponding property on the dependent end. Requires: The association has a referential constraint, and the specified principalProperty is one of the properties on the principal end.
public GetCorrespondingDependentProperty ( System.Data.Metadata.Edm.NavigationProperty navProperty, System.Data.Metadata.Edm.EdmProperty principalProperty ) : System.Data.Metadata.Edm.EdmProperty
navProperty System.Data.Metadata.Edm.NavigationProperty
principalProperty System.Data.Metadata.Edm.EdmProperty
Résultat System.Data.Metadata.Edm.EdmProperty

GetCorrespondingPrincipalProperty() public méthode

Given a property on the dependent end of a referential constraint, returns the corresponding property on the principal end. Requires: The association has a referential constraint, and the specified dependentProperty is one of the properties on the dependent end.
public GetCorrespondingPrincipalProperty ( System.Data.Metadata.Edm.NavigationProperty navProperty, System.Data.Metadata.Edm.EdmProperty dependentProperty ) : System.Data.Metadata.Edm.EdmProperty
navProperty System.Data.Metadata.Edm.NavigationProperty
dependentProperty System.Data.Metadata.Edm.EdmProperty
Résultat System.Data.Metadata.Edm.EdmProperty

GetDependentProperties() public méthode

Gets the collection of properties that are on the dependent end of a referential constraint for the specified navigation property. Requires: The association has a referential constraint.
public GetDependentProperties ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : ReadOnlyMetadataCollection
navProperty System.Data.Metadata.Edm.NavigationProperty
Résultat ReadOnlyMetadataCollection

GetElementType() public méthode

If the passed in TypeUsage represents a collection this method returns final element type of the collection, otherwise it returns the value passed in.
public GetElementType ( TypeUsage typeUsage ) : TypeUsage
typeUsage TypeUsage
Résultat TypeUsage

GetPrincipalProperties() public méthode

Gets the collection of properties that are on the principal end of a referential constraint for the specified navigation property. Requires: The association has a referential constraint.
public GetPrincipalProperties ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : ReadOnlyMetadataCollection
navProperty System.Data.Metadata.Edm.NavigationProperty
Résultat ReadOnlyMetadataCollection

GetSubtypesOf() public méthode

Returns the subtype of the EntityType in the current itemCollection
public GetSubtypesOf ( EntityType type, ItemCollection itemCollection, bool includeAbstractTypes ) : IEnumerable
type System.Data.Metadata.Edm.EntityType
itemCollection ItemCollection
includeAbstractTypes bool
Résultat IEnumerable

Inverse() public méthode

Returns the NavigationProperty that is the other end of the same association set if it is available, otherwise it returns null.
public Inverse ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : System.Data.Metadata.Edm.NavigationProperty
navProperty System.Data.Metadata.Edm.NavigationProperty
Résultat System.Data.Metadata.Edm.NavigationProperty

IsCascadeDeletePrincipal() public méthode

True if the specified association end is the principal in an identifying relationship. or if the association end has cascade delete defined.
public IsCascadeDeletePrincipal ( System.Data.Metadata.Edm.AssociationEndMember associationEnd ) : bool
associationEnd System.Data.Metadata.Edm.AssociationEndMember
Résultat bool

IsCascadeDeletePrincipal() public méthode

True if the source end of the specified navigation property is the principal in an identifying relationship. or if the source end has cascade delete defined.
public IsCascadeDeletePrincipal ( System.Data.Metadata.Edm.NavigationProperty navProperty ) : bool
navProperty System.Data.Metadata.Edm.NavigationProperty
Résultat bool

IsIdentifyingRelationship() public méthode

True if the specified association type is an identifying relationship. In order to be an identifying relationship, the association must have a referential constraint where all of the dependent properties are part of the dependent type's primary key.
public IsIdentifyingRelationship ( System.Data.Metadata.Edm.AssociationType association ) : bool
association System.Data.Metadata.Edm.AssociationType
Résultat bool

IsKey() public méthode

True if the EdmProperty is a key of its DeclaringType, False otherwise.
public IsKey ( System.Data.Metadata.Edm.EdmProperty property ) : bool
property System.Data.Metadata.Edm.EdmProperty
Résultat bool

IsNullable() public méthode

True if the EdmProperty TypeUsage is Nullable, False otherwise.
public IsNullable ( System.Data.Metadata.Edm.EdmProperty property ) : bool
property System.Data.Metadata.Edm.EdmProperty
Résultat bool

IsNullable() public méthode

True if the TypeUsage is Nullable, False otherwise.
public IsNullable ( TypeUsage typeUsage ) : bool
typeUsage TypeUsage
Résultat bool

IsPrincipalEndOfIdentifyingRelationship() public méthode

True if the specified association end is the principal end in an identifying relationship. In order to be an identifying relationship, the association must have a referential constraint where all of the dependent properties are part of the dependent type's primary key.
public IsPrincipalEndOfIdentifyingRelationship ( System.Data.Metadata.Edm.AssociationEndMember associationEnd ) : bool
associationEnd System.Data.Metadata.Edm.AssociationEndMember
Résultat bool

IsSubtypeOf() public méthode

requires: firstType is not null effects: if secondType is among the base types of the firstType, return true, otherwise returns false. when firstType is same as the secondType, return false.
public IsSubtypeOf ( System.Data.Metadata.Edm.EdmType firstType, System.Data.Metadata.Edm.EdmType secondType ) : bool
firstType System.Data.Metadata.Edm.EdmType
secondType System.Data.Metadata.Edm.EdmType
Résultat bool

MetadataTools() public méthode

Initializes an MetadataTools Instance with the TextTransformation (T4 generated class) that is currently running
public MetadataTools ( object textTransformation ) : System
textTransformation object
Résultat System

NeedsHandleCascadeDeleteMethod() public méthode

True if this entity type requires the HandleCascadeDelete method defined and the method has not been defined on any base type
public NeedsHandleCascadeDeleteMethod ( ItemCollection itemCollection, EntityType entity ) : bool
itemCollection ItemCollection
entity System.Data.Metadata.Edm.EntityType
Résultat bool

TryGetStringMetadataPropertySetting() public static méthode

public static TryGetStringMetadataPropertySetting ( System.Data.Metadata.Edm.MetadataItem item, string propertyName, string &value ) : bool
item System.Data.Metadata.Edm.MetadataItem
propertyName string
value string
Résultat bool

UnderlyingClrType() public méthode

This method returns the underlying CLR type given the c-space type. Note that for an enum type this means that the type backing the enum will be returned, not the enum type itself.
public UnderlyingClrType ( System.Data.Metadata.Edm.EdmType edmType ) : Type
edmType System.Data.Metadata.Edm.EdmType
Résultat System.Type