Search This Blog

Wednesday, October 3, 2012

C#/.NET Get NHibernate session information/database type/capabilities

Before changing the database structure (adding/removing columns or adding/removing comments to certain columns) you need to know which operations are allowed on a specific database type. This can be retrieved as follows:

var dialect = (Dialect)HibernateTemplate.Execute(del => del.GetSessionImplementation().Factory.Dialect;

Commenting capability (which is impossible in SQLite) can be read from:

dialect.SupportsCommentOn


4 comments:

If you like this post, please leave a comment :)