61,651
社区成员




public class NHibernateHelper
{
public static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2008
.ConnectionString(c => c.FromConnectionStringWithKey("PISConn")))
.Mappings(m => m.FluentMappings
.AddFromAssemblyOf<ProductMap>()).ExposeConfiguration(CreateSchema)
.BuildSessionFactory();
}
private static void CreateSchema(Configuration cfg)
{
var schemaExport = new SchemaExport(cfg);
schemaExport.SetOutputFile("NHSQL.sql");
schemaExport.Create(false, true);
}
}