Have you ever found out that your application believed that an entity property was stored in DB as a different type than it actually was (varchar instead of nvarchar, int instead of tinyint etc.)? Maybe you haven't, but would like to check before learning it in production the hard way? Most of today's ORM mapping mechanisms allow to generate the DB schema automatically, but there is a number of reasons to create or update it manually. One of them is that you gain better flexibility and could achieve some designs not possible otherwise. On the other hand the developer overtake the responsibility for the consistency between application model and the DB schema. And as we (developers) all know - even though we are almost perfect :), if something is not automatically checked, some tiny error will eventually find a way to make our life harder.

Divergence between configuration and the actual database schema could lead to serious issues i.e. Implicit conversion. What if we could prevent it with just several lines of a simple test code? Read on to learn how to do it for NHibernate.

Continue Reading...