Verifying Entity Mapping using Linq-to-SQL
One of the things I enjoy about using FluentNHibernate is the PersistenceSpecification class VerifyMapping method which allows me to verify that my database schema, mapping and domain are in sync. When using other ORMs I tend to recreate this feature. Working with one client recently who uses Linq-to-SQL I did it again and decided it is time to share it:
If you have an base class or interface for entities that defines a common identifier then you can cut out the identity expression. In the code base I was working on the entities did not have any common identifier property so it was something I needed to pass in as part of the check.