Whats the best, most consistent way to check if a table exists in NHibernate (or with Fluent-NHibernate)?
Is it even possible? I mean it seems like a simple task for such a heavy-duty ORM.
Also on a related question, can you check if a set of tables or a whole schema exists with NHibernate?
Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents, you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.
If you store you NHibernate configuration somewhere or do it before you build your session factory it is possible to validate the generated schema against the database.
public void ValidateSchema(Configuration config)
{
new SchemaValidator(config).Validate();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With