How do I set up Flush Mode in Fluent Nhibernate? - fluent-nhibernate

I need to set the flush mode in fluent NH. I know how to do it with standard NH but I cant figure out how to do it with fluent.

Related

FluentNHibernate automap to backing field

In our project we use MVC3 with a domain model and NHibernate as DAL.
We configure NHibernate with fluent configuration using auto mapping.
At the moment we are trying to devise a validation strategy.
We need validations that go beyond data annotations.
One place where we are sure to catch all attempts to alter (and corrupt) the data would be the property setters. As some checks involve querying the database, we do not want to do that when NHibernate restored objects form the database.
So for this to be a viable solution: Can we instruct FluentNhibernate to satandard AutoMap to the backing fields of the properties.
Thanks.
You can explicitly tell FNH to use a backing field: unfortunately AutoMapping support looks unlikely out-of-the box as there doesn't seem to be anything applicable in the configuration options.

Nibernate / Fluent NHibernate : Using Filter with SubclassMap

Using Fluent NHibernate, I have succeeded in setting up a global Filter on my NHibernate session, and using it in ClassMap classes. The Filter WHERE clause is appended to queries using that map automagically as it should - as described in other posts on this forum.
Fluent NHibernate does not implement ApplyFilter<> of SubclassMap, it is only implemented for ClassMap. It was easy to do a test by adding a filter through the back door, by passing a MappingProviderStore to the SubclassMap Constructor, and adding the filter to that. Inspecting the resulting classes in the debugger shows that everything is populated identically to a ClassMap. However, not surprisingly, this didn't work.
Can someone tell me if Filters SHOULD work with SubclassMap in NHibernate itself?
Is this therefore something that might eventually be supported (e.g. by implementing SubclassMap.ApplyFilter<>) in Fluent NHibernate?
Using Fluent NHibernate 2.1, with NHibernate 3.1
I'm supposing that fluent call apply filter the :
as per this Jira Entry, at Oct 2012 the function is not yet availavle in NH.

Equivalent for IDbSet<T> in Fluent NHibernate?

Hey there, I've started to play around with Fluent NHibernate and now I want to could do something like IDbSet<T> like I could in EF Code First.. However I cant find any equivalent interface?
Thanks in adavance!
In NHibernate you operate with entities through the ISession interface (reference docs with example). You may wrap the session in a repository if you want (example: Sharp Architecture repository)

Does FluentNH's PersistenceSpecification allow XML mappings to be tested?

Is it possible to use Fluent NHibernate's PersistenceSpecification to test NHibernate mappings done via XML?
The PersistenceSpecification takes session as its only parameter, so I do not see reason why not.

Is it possible to set a default value on a property with NHibernate

I'm using Fluent NHibernate for my mappings and the SchemaExport class to the database schema.
Is it possible with NHibernate to set a default value for a property/column in the generated database schema?
Not to my knowledge, no - not in the generated schema.
You can just set the property in your constructor though.
It is definitely supported, both in XML mapping and in Fluent NHibernate.
For XML mapping, use the <column> child element of <property>, documented here.
For Fluent NHibernate, there's a method for fluent mapping, as described in this SO answer.