I have a class
abstract class Entity<T> where T : Entity<T>
{
public virtual Guid ID { get; private set; }
}
all my entities are inherited from it. In the case of employee entity that’s impossible to have two employees with same passport-sn, and other identity-specific documents.
Howcome I disallow to put two employees with different surrogate keys and the same passport number to a database?
Is there any constraint in mapping?
Thanks!
you can add the Unique constrain for passport
if you are using Fluent:
In your domain if all the entities inherits from Entity all of them will use a surrogate keys so you have to handle any other constrains