Consider the following class hierarchy:
public abstract class Animal {}
public class Dog : Animal
{
public int DogTagNumber { get; set; }
}
public class Cat : Animal
{
public int CatTagNumber { get; set; }
}
Note: DogTagNumber and CatTagNumber is purposely placed in the subclasses instead of as TagNumber in Animal class to demonstrate property explicit to each subclass.
The question: Using Fluent NHibernate, is it possible to map unique constrain on class discriminator together with subclasses's explicit properties, like below:
Unique("DOG", DogTagNumber) and also Unique("CAT", CatTagNumber)
The purpose is to ensure the uniqueness of each Dog and Cat with regard to the discriminator in the table on database level.
Thanks in advance.