Namespaces

Types in FluentNHibernate.Mapping

Type ClassMap<T>

Namespace FluentNHibernate.Mapping

Parent ClasslikeMapBase<T>

Interfaces IMappingProvider

Defines a mapping for an entity. Derive from this class to create a mapping, and use the constructor to control how your entity is persisted.

Methods

Properties

Public instance methods

ClassMap<T> ApplyFilter(string name)

Applies a filter to this entity given it's name.
Parameters
string name

The filter's name

ClassMap<T> ApplyFilter(string name, string condition)

Applies a filter to this entity given it's name.
Parameters
string name

The filter's name

string condition

The condition to apply

ClassMap<T> ApplyFilter<TFilter>()

Applies a named filter to this one-to-many.

ClassMap<T> ApplyFilter<TFilter>(string condition)

Applies a named filter to this entity.
Parameters
string condition

The condition to apply

ClassMap<T> BatchSize(int size)

Sets the query batch size for this entity.
Parameters
int size

Batch size

CompositeIdentityPart<T> CompositeId()

Create a composite identity. This is an identity composed of multiple columns. Note: Prefer using a surrogate key over a composite key whenever possible.

CompositeIdentityPart<T> CompositeId<TId>(Expression<Func<T, TId>> memberExpression)

Create a composite identity represented by an identity class. This is an identity composed of multiple columns. Note: Prefer using a surrogate key over a composite key whenever possible.
Parameters
Expression<Func<T, TId>> memberExpression

Composite id property

DiscriminatorPart DiscriminateSubClassesOnColumn<TDiscriminator>(string columnName, TDiscriminator baseClassDiscriminator)

Specify that this entity should use a discriminator with it's subclasses. This is a mapping strategy called table-per-inheritance-hierarchy; where all subclasses are stored in the same table, differenciated by a discriminator column value.
Parameters
string columnName

Discriminator column name

TDiscriminator baseClassDiscriminator

Default discriminator value

DiscriminatorPart DiscriminateSubClassesOnColumn<TDiscriminator>(string columnName)

Specify that this entity should use a discriminator with it's subclasses. This is a mapping strategy called table-per-inheritance-hierarchy; where all subclasses are stored in the same table, differenciated by a discriminator column value.
Parameters
string columnName

Discriminator column name

IdentityPart Id()

Create an Id that doesn't have a corresponding property in the domain object, or a column in the database. This is mainly for use with read-only access and/or views. Defaults to an int identity with an "increment" generator.

IdentityPart Id(Expression<Func<T, object>> memberExpression, string column)

Specify the identifier for this entity.
Parameters
Expression<Func<T, object>> memberExpression

Identity property

string column

Column name

IdentityPart Id(Expression<Func<T, object>> memberExpression)

Specify the identifier for this entity.
Parameters
Expression<Func<T, object>> memberExpression

Identity property

IdentityPart Id<TId>(string column)

Create an Id that doesn't have a corresponding property in the domain object.
Parameters
string column

Name and column name of the id

IdentityPart Id<TId>()

Create an Id that doesn't have a corresponding property in the domain object, or a column in the database. This is mainly for use with read-only access and/or views.

ImportPart ImportType<TImport>()

Imports an existing type for use in the mapping.

void Join(string tableName, Action<JoinPart<T>> action)

Links this entity to another table, to create a composite entity from two or more tables.
Parameters
string tableName

Joined table name

Action<JoinPart<T>> action

Joined table mapping

NaturalIdPart<T> NaturalId()

Create a natural identity. This is a secondary identifier that has "business meaning" moreso than the primary key.

void Persister(string type)

Specifies a persister to be used with this entity
Parameters
string type

Persister type

void Persister<TPersister>()

Specifies a persister to be used with this entity

void Proxy(string type)

Specifies a proxy class for this entity.
Parameters
string type

Proxy type

void ReadOnly()

Set the mutability of this class, sets the mutable attribute.

TuplizerPart Tuplizer(TuplizerMode mode, Type tuplizerType)

Configures the tuplizer for this entity. The tuplizer defines how to transform a Property-Value to its persistent representation, and viceversa a Column-Value to its in-memory representation, and the EntityMode defines which tuplizer is in use.
Parameters
TuplizerMode mode

Tuplizer entity-mode

Type tuplizerType

Tuplizer type

void UseUnionSubclassForInheritanceMapping()

Specifies that any subclasses of this entity should be treated as union-subclass mappings. Don't use this in combination with a discriminator, as they are mutually exclusive.

VersionPart Version(Expression<Func<T, object>> memberExpression)

Specifies that this class should be versioned/timestamped using the given property.
Parameters
Expression<Func<T, object>> memberExpression

Version/timestamp property

void Where(string where)

Defines a SQL 'where' clause used when retrieving objects of this type.

Public properties

CacheBuilder Cache get;

Specify the caching for this entity.

Type EntityType get;

HibernateMappingPart HibernateMapping get;

Specify settings for the container/hibernate-mapping for this class. Note: Avoid using this, if possible prefer using conventions.

ClassMap<T> Not get;

Inverts the next boolean option

OptimisticLockBuilder<TParent> OptimisticLock get;

Sets the optimistic locking strategy

PolymorphismBuilder<T> Polymorphism get;

Sets the polymorphism behaviour

SchemaActionBuilder<T> SchemaAction get;

Sets the schema action behaviour