I've got a class

abstract class Entity<T> where T : Entity<T>
    public virtual Guid ID { get; private set; }

my organizations are inherited from this. Within the situation of employee entity that's impossible to possess two employees with same passport-sn, along with other identity-specific documents.

Howcome I disallow to place two employees with various surrogate keys and also the same passport number to some database?

Can there be any constraint in mapping?


you can include the initial constrain for passport

if you work with Fluent:

mapping.Id( employee => employee.Id);
mapping.Map(employee  => employee.passport ).Unique(); 

Inside your domain if all of the organizations gets from Entity these uses a surrogate secrets so you've to deal with every other constrains