Copied connectionstring caused FluentConfigurationException
Posted by Daniel Kjellqvist on August 18th, 2010Today I had a problem with a FluentConfigurationException. The day before I’ve used “the same” configuration and it worked. I just couldn’t understand what’s wrong..
Here’s the exception message: “FluentNHibernate.Cfg.FluentConfigurationException: An
invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.”
But I couldn’t see anything wrong in the configuration:
var config = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(connectionString)
.ProxyFactoryFactory(typeof(NHibernate.ByteCode.LinFu.ProxyFactoryFactory)))
.Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf<Customer>(new CrmAutomappingConfiguration())
.Conventions.AddFromAssemblyOf<ColumnNullabilityConvention>()
.UseOverridesFromAssemblyOf<CustomerMappingOverride>()
.IgnoreBase<Entity>));
It’s just a simple fluent nhibernate configuration!!!!
So I debugged and found this connection string: “Data Source=localhost\\sqlexpress;Initial Catalog=TestDB;Integrated Security=SSPI;”
Nothing wrong there I thought… but after a while i saw the double backslash (localhost\\sqlexpress)!!!!!
The day before I had the connection string inside the configuration and the compiler needs the double backslash, but of course that’t not the case when I moved the connectionstring to the app.config.
So I just erased one of the backslashes and everything worked fine.
It remembered me that everything makes a difference. =)
Recent Comments