views:

501

answers:

1

Hi to FNH peeps,

1) Could anyone give a clear explaination of what SessionSource is intended for, and why would I want to use this rather than just Fluently.Configure()....BuildSessionFactory()?

2) What is the PersistenceSpecification class for? I know you can use it for persistence testing (http://wiki.fluentnhibernate.org/Persistence%5Fspecification%5Ftesting), but I've seen it crop up in other scenarios, but am not really sure what for.

Thanks!

S

+5  A: 

1) SessionSource is little more than a ISession factory. One particularly useful usage of it is in SQLite in-memory tests. See, SQLite has a in-memory mode, in which the database is never written to a file. This mode is very useful for unit-testing your persistent classes since it's very fast. Problem is, this database lasts exactly one connection. The moment the connection is closed, the database vanishes. Therefore, SingleConnectionSessionSourceForSQLiteInMemoryTesting is used to ensure that the same connection is always used.

2) It's just like you say, it's used for persistence specification testing as explained in the wiki... where else did you see it?

Mauricio Scheffer