Wednesday, October 15, 2014

Auto-mapping domain models with schemas using NHibernate

Auto-mapping domain models with schema is easy with NHibernate's built-in auto-mapping

Here's how an auto-mapping of domain models with schema could be built with NHibernate:

DDL of the sample domain models with schema:

The domain models' properties don't have virtual in them, Virtuosity.Fody automates that for us. Our program automates manual and boring work for the user, developers should be recipient of automations too :-) Here are the sample domain models with schemas:

For schema enforcement on domain models, it's preferrable to enclose them in a static class rather than in a namespace. namespace could be bypassed

Happy Coding!

No comments:

Post a Comment