1: Dim cfg As New Configuration()
2: Dim props As IDictionary(Of String, String) = New Dictionary(Of String, String)
3: With props
4: .Add(Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider")
5: .Add(Environment.Dialect, "NHibernate.Dialect.Oracle10gDialect")
6: .Add(Environment.ConnectionDriver, "NHibernate.Driver.OracleDataClientDriver")
7: .Add(Environment.ConnectionString, "Data Source=XE;Persist Security Info=True;User ID=myUsername;Password=myPassword")
8: .Add(Environment.Isolation, "ReadCommitted")
9: .Add(Environment.QuerySubstitutions, "true 1, false 0, yes 'Y', no 'N'")
10: .Add(Environment.ShowSql, "True")
11: .Add(Environment.ProxyFactoryFactoryClass, "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle")
12: .Add(Environment.Hbm2ddlKeyWords, "none")
13: End With
14: Try
15: With cfg
16: .SetProperties(props)
17: .AddAssembly("MyAssembly")
18: factory = .BuildSessionFactory()
19: End With
20: Catch ex As Exception
21: Throw (ex)
22: End Try