Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created February 24, 2010 19:11
Show Gist options
  • Save jfromaniello/313735 to your computer and use it in GitHub Desktop.
Save jfromaniello/313735 to your computer and use it in GitHub Desktop.
var fail = false;
var configuration = new Configuration().Configure();
configuration.Properties[Environment.ShowSql] = "false";
var sessionFactory = configuration.BuildSessionFactory();
using (var session = sessionFactory.OpenSession())
{
var allClassMetadata = session.SessionFactory.GetAllClassMetadata();
foreach (var entry in allClassMetadata)
{
try
{
session.CreateCriteria(entry.Key)
.SetMaxResults(0).List();
Console.WriteLine("{0} mapping is ok.", entry.Key);
}catch(Exception ex)
{
Console.WriteLine("{0} mapping is wrong. See the exception message:", entry.Key);
Console.WriteLine(ex.Message);
fail = true;
}
}
}
Assert.IsFalse(fail);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment