Contribute to FluentNHibernate/fluent-nhibernate development by creating an read through our API documentation, or just see what’s available for reading in. i would advice to use some kind of IDE which is capable of autoresolve the namespaces (Visual Studio, Sharpdevelop, ) then you only need to copy paste the. Visual Studio sample solution containing the code using Fluent NHibernate which documentation on how to achieve certain goals with Fluent NHibernate.

Author: Mikinos Tokus
Country: Eritrea
Language: English (Spanish)
Genre: Video
Published (Last): 23 September 2005
Pages: 208
PDF File Size: 5.47 Mb
ePub File Size: 12.81 Mb
ISBN: 563-7-93571-798-5
Downloads: 66098
Price: Free* [*Free Regsitration Required]
Uploader: Samutaur

Apart from the most basic of domains, nearly every situation will require mapping some form of relationship. You’ll quickly get used to these lambdas, as they’re used everywhere in Fluent NHibernate.

If you wanted to do a table-per-class-hierarchy strategy, then you just need to specify the discriminator column in your ClassMap. Fluent NHibernate’s interface is designed for discoverability.

That’s it, you’ve now created a references relationship between book and author.

Fluent NHibernate – The official website

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The remaining columns hold the identifier. Going with the same flunt as above, this time we’re mapping the author side which joins into the books table returning a collection of any books of that author. There are three things you need to provide to be able to map using an Any; a column that holds the type of the entitiy, at least one column holding the identifier value, and a type for the identifier itself.

Property ; the x on the left is the parameter declaration, which will be the entity you’re mapping, while the x. The users who voted to close gave this specific reason: As you can see, the first parameter references the Address property on our entity, which is the property that holds our component. HasOne is usually reserved for a special case, generally you’d use a References in most situations see: There are two strategies for mapping inheritance hierarchies in Fluent NHibernate, table-per-class-hierarchy and table-per-subclass; the former being a subclass, and the latter a joined-subclass.


The only difference is in ParentMap we’re now calling DiscriminateSubclassesOnColumn with documebtation “type” parameter; this parameter is the column name in the table which dictates what class each row represents. Components are a clever way of documwntation a normalized data model into a flient reasonable object model. Firo 28k 4 45 Instead, describe the problem and what has been done so far to doccumentation it.

There are a few different types of collections you can use, and they’re all available under the Documenyation call.

Fluent mapping is the namesake mapping style that Fluent NHibernate uses.

Fluent NHibernate API documentation – Stack Overflow

That’s all you need for most situations. Any really only should be used if you know what you’re doing.

For docunentation, if your Id property is an intthen we assume you’re using an identity column; similarly, if nhiebrnate use a Guid then we assume it’s a Guid Comb. The second property is where we define what makes up the component. My biggest obstacle to getting the hang of Fluent NHibernate so far has been finding the namespaces for the classes that I need to work through samples I find blog posts, SO questions, etc.

Fluent mapping

For illustrative purposes we’ll be mapping the relationship between a book and it’s author. There are numerous customisations available through methods chained from the Map call. In database terms that would be a book table with a foreign key column referencing the primary key of a author table.


HasMany is probably the most common collection-based relationship you’re going to use; a HasMany is the “other side” of a References relationship. This type of mapping always requires more than one column. If you really do want a one-to-one, then you can use the HasOne method.

Subclasses work in a very similar way to ClassMap’sin that you create a derived class which you put your mappings documenhation it’s just you use SubclassMap instead of ClassMap. As with all other fluent mappings, you can chain calls to customise the reference relationship. There are a few different types of collections you can use, and they’re all available under the HasManyToMany call.

How could I have possibly used VS as long as I have and never noticed its namespace resolution support? For example, if we were to need to change what column the property maps to we could use the Column method, or for explicitly specifying the identity generator you could use the GeneratedBy property.


The parent mapping dictates what the subclass mapping strategy will be by either specifying a discriminator or not discriminators are required for table-per-class-hierarchy.

For example if you wanted to specify the cascade strategy you’d use the Cascade property.