C# Class Breeze.PocoMetadata.EntityDescriptor

Describes the metadata for a set of entities. The PocoMetadataBuilder calls methods on this class to determine how to generate metadata for the entities. Extend this class to adapt to your data model.
Datei anzeigen Open project: Breeze/breeze.tooling Class Usage Examples

Public Methods

Method Description
GetAutoGeneratedKeyType ( Type type ) : string

Get the autoGeneratedKeyType value for the given type. Should be defined even if the actual key property is on a base type.

GetDataPropertyType ( Type type, PropertyInfo propertyInfo ) : Type

Change the type of the given data property in the metadata. For example, a custom wrapper type on the server may be unwrapped on the client, and the metadata reflects this.

GetForeignKeyName ( Type type, PropertyInfo propertyInfo ) : string

Get the foreign key for the given scalar navigation property. This is another property on the same entity that establishes the foreign key relationship.

GetMissingFKHandling ( Type type, PropertyInfo propertyInfo ) : MissingKeyHandling

Determine the generator behaves if a foreign key data property cannot be found for the given navigation property.

GetMissingPKHandling ( Type type ) : MissingKeyHandling

Determine the generator behaves if a primary key is missing on an entity.

GetResourceName ( Type type ) : string

Get the server resource name (endpoint) for the given type. E.g. for entity type Product, it might be "Products". This value is used by Breeze client when composing a query URL for an entity.

Include ( Type type ) : bool

Filter types from metadata generation.

IsComplexType ( Type type ) : bool

Determine if the given type is a "Complex Type" instead of an "Entity". Complex Types are sometimes called component types or embedded types, because they are part of the parent entity instead of being related by foreign keys.

IsKeyProperty ( Type type, PropertyInfo propertyInfo ) : bool

Determine if the property is part of the entity key.

IsVersionProperty ( Type type, PropertyInfo propertyInfo ) : bool

Determine if the property is a version property used for optimistic concurrency control.

Pluralize ( string s ) : string

Lame pluralizer. Assumes we just need to add a suffix. Consider using System.Data.Entity.Design.PluralizationServices.PluralizationService.

Replace ( Type type, IEnumerable types ) : Type

Replace the given type wherever it appears in the metadata. Can be used to replace an interface with a class.

Method Details

GetAutoGeneratedKeyType() public method

Get the autoGeneratedKeyType value for the given type. Should be defined even if the actual key property is on a base type.
public GetAutoGeneratedKeyType ( Type type ) : string
type System.Type Entity type for which metadata is being generated
return string

GetDataPropertyType() public method

Change the type of the given data property in the metadata. For example, a custom wrapper type on the server may be unwrapped on the client, and the metadata reflects this.
public GetDataPropertyType ( Type type, PropertyInfo propertyInfo ) : Type
type System.Type Entity type for which metadata is being generated
propertyInfo System.Reflection.PropertyInfo Property being considered
return System.Type

GetForeignKeyName() public method

Get the foreign key for the given scalar navigation property. This is another property on the same entity that establishes the foreign key relationship.
public GetForeignKeyName ( Type type, PropertyInfo propertyInfo ) : string
type System.Type Entity type for which metadata is being generated
propertyInfo System.Reflection.PropertyInfo Scalar navigation/association property
return string

GetMissingFKHandling() public method

Determine the generator behaves if a foreign key data property cannot be found for the given navigation property.
public GetMissingFKHandling ( Type type, PropertyInfo propertyInfo ) : MissingKeyHandling
type System.Type Entity type for which metadata is being generated
propertyInfo System.Reflection.PropertyInfo Scalar navigation/association property
return MissingKeyHandling

GetMissingPKHandling() public method

Determine the generator behaves if a primary key is missing on an entity.
public GetMissingPKHandling ( Type type ) : MissingKeyHandling
type System.Type Entity type for which metadata is being generated
return MissingKeyHandling

GetResourceName() public method

Get the server resource name (endpoint) for the given type. E.g. for entity type Product, it might be "Products". This value is used by Breeze client when composing a query URL for an entity.
public GetResourceName ( Type type ) : string
type System.Type Entity type for which metadata is being generated
return string

Include() public method

Filter types from metadata generation.
public Include ( Type type ) : bool
type System.Type
return bool

IsComplexType() public method

Determine if the given type is a "Complex Type" instead of an "Entity". Complex Types are sometimes called component types or embedded types, because they are part of the parent entity instead of being related by foreign keys.
public IsComplexType ( Type type ) : bool
type System.Type Entity type for which metadata is being generated
return bool

IsKeyProperty() public method

Determine if the property is part of the entity key.
public IsKeyProperty ( Type type, PropertyInfo propertyInfo ) : bool
type System.Type Entity type for which metadata is being generated
propertyInfo System.Reflection.PropertyInfo Property being considered
return bool

IsVersionProperty() public method

Determine if the property is a version property used for optimistic concurrency control.
public IsVersionProperty ( Type type, PropertyInfo propertyInfo ) : bool
type System.Type Entity type for which metadata is being generated
propertyInfo System.Reflection.PropertyInfo Property being considered
return bool

Pluralize() public method

Lame pluralizer. Assumes we just need to add a suffix. Consider using System.Data.Entity.Design.PluralizationServices.PluralizationService.
public Pluralize ( string s ) : string
s string String to pluralize
return string

Replace() public method

Replace the given type wherever it appears in the metadata. Can be used to replace an interface with a class.
public Replace ( Type type, IEnumerable types ) : Type
type System.Type Type to replace
types IEnumerable List of available types provided to the PocoMetadataBuilder
return System.Type