i m doing the configuration of Fluent nHibernate in my application with the following code ,
var FNHConfig = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(c => c.FromConnectionStringWithKey("FNHConnection"))
)
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetCallingAssembly()))
开发者_如何学C .BuildConfiguration();
return FNHConfig.BuildSessionFactory();
but it giving exception saying that "An invalid or incomplete configuration was used while creating a SessionFactory. ". anyone have idea how to solve this exception ?
Thanks
It's most likely a mapping problem like Mark says above but you need to provide more detail. That is the generic outer exception that is thrown if you fail to build the Session Factory.
try
{
var FNHConfig = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(c => c.FromConnectionStringWithKey("FNHConnection"))
)
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetCallingAssembly()))
.BuildConfiguration();
return FNHConfig.BuildSessionFactory();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Take a look at the error in the console window and you will most likely be lead to the culprit of this exception.
If you dive into the inner exception it will most likely tell you what the issue is, NH3.X has pretty decent exception messages.
I'll take a stab in the dark and say that you haven't marked all the public Properties, Methods and Events on your object as virtual
.
Can you post your Business Objects and Mapping Classes.
精彩评论