Is it possible to use LocalDB databases with NHibernate? If yes, what should be installed/configured?
Currently when trying to use connection string like Data Source=(LocalDb)\v11.0;Initial Catalog=tst1;Integrated Security=SSPI when creating SessionFactory I get
System.Data.SqlClient.SqlException : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ----> System.ComponentModel.Win32Exception : The network path was not found
However, I'm able to connect to (LocalDb)\v11.0 via SQL Server Object Explorer, and Entity Framework works with that connection string. So, what am I doing wrong with NH, or it's impossible to use LocalDB with NH at the moment?
You might have to use the archaic syntax with nH, e.g.:
np:\\.\pipe\LOCALDB#ABB78D50\tsql\query
(For some background on why this syntax is sometimes required for connection strings, see this tip on mssqltips.com.)
I realize this isn't an ideal answer, but until nHibernate updates to officially support SqlLocalDb, it might be your only choice... hopefully I'm wrong and someone has figured out a more elegant way to connect.