I left 3 classes in my library: ProductMap, Product, and DBHelper. I
still get the error. Here are the 3 classes:
public class ProductMap : ClassMap<Product>
{
public ProductMap()
{
Id(x => x.Id);
Map(x => x.Category);
Map(x => x.Discontinued);
Map(x => x.Name);
}
}
public class Product
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Category { get; set; }
public virtual bool Discontinued { get; set; }
}
public class DBHelper
{
private static ISessionFactory _sessionFactory;
private static ISessionFactory SessionFactory
{
get
{
if (_sessionFactory == null)
{
_sessionFactory = Fluently.Configure()
.Database
(SQLiteConfiguration.Standard.UsingFile("nhibernate.db"))
.Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<Product>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
return _sessionFactory;
}
}
public static ISession OpenSession()
{
return SessionFactory.OpenSession();
}
private static void BuildSchema(Configuration config)
{
if (File.Exists("nhibernate.db"))
File.Delete("nhibernate.db");
new SchemaExport(config).Execute(false, true, false,
false);
}
}
Here is what I'm calling in a separate assembly that triggers the
Exception.
//This code fails
using (ISession session = DBHelper.OpenSession())
{
//empty
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---