Ok, it seems I resolved this problem by myself. This is what I found (maybe
it will help someone):

Going deeper to NHibernate sources I noticed that only when
*setting.IsKeywordsImportEnabled* is set the crashing part is fired
(SchemaMetadataUpdater.Update(this)).
There the SuppliedConnectionProviderConnectionHelper tries to cast some type
to DbConnection, this type is probably NpgsqlConnection class which doesn't
derive from DbConnection, however it implements IDbConnection.

How to disable IsKeywordImportEnabled?

sessionFactory = Fluently.Configure() 
                .Database(databaseConfiguration) 
                .Mappings(m => 
                    { 
                       
m.FluentMappings.AddFromAssemblyOf<Models.MyClass>(); 
                    }) 
                *.ExposeConfiguration(c =>
                    {
                        c.SetProperty(Environment.Hbm2ddlKeyWords, "none");
                    })*
                .BuildSessionFactory();

Actually I don't know what this setting will cause, but retrieving and
inserting entities seem to work fine.

--
View this message in context: 
http://mono.1490590.n4.nabble.com/FluentNHibernate-InvalidCastException-at-creating-SessionFactory-tp3770661p3771120.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.
_______________________________________________
Mono-aspnet-list mailing list
Mono-aspnet-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

Reply via email to