Can anyone tell me the correct syntax?
I need to enter the connection string directly in my code in order to Unit test. Everything works fine when the connection string is in the web.config file as:
<add name="SQLNorthwindConnectionString" connectionString="Data Source=localhost\try2;Initial Catalog=Northwind;Integrated Security=True" providerName="System.Data.SqlClient"/>
Using it in the code as:
_SessionFactory = Fluently.Configure().
Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("SQLNorthwindConnectionString")).
ShowSql().
Cache(c => c.ProviderClass<SysCacheProvider>(). UseQueryCache())).
Mappings(m => m.FluentMappings.AddFromAssemblyOf<FNHibernateHelperSQLite>().Conventions.AddFromAssemblyOf<NorthwindMVCApp.FNHibernate.CustomForeignKeyConvention>()).
BuildSessionFactory();
But this doesn’t work:
_SessionFactory = Fluently.Configure().
Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.Is("Data Source=localhost\try2;Initial Catalog=Northwind;Integrated Security=True")).
ShowSql().
Cache(c => c.ProviderClass<SysCacheProvider>().UseQueryCache())).
Mappings(m => m.FluentMappings.AddFromAssemblyOf<FNHibernateHelperSQLite>().Conventions.AddFromAssemblyOf<NorthwindMVCApp.FNHibernate.CustomForeignKeyConvention>()).
BuildSessionFactory();
Remove the lambda expression :