fluent-nhibernate
fluent-nhibernate copied to clipboard
Question: Unique() constraint that allow NULLS ?
There is an interesting situation when is needed that a UNIQUE CONSTRAINT to take into account a WHERE clause. eg for SQL Server 2008:
CREATE UNIQUE NONCLUSTERED INDEX idx_yourcolumn_notnull
ON YourTable(yourcolumn)
WHERE yourcolumn IS NOT NULL;
There is a topic on StackOverflow regards this situation :
http://stackoverflow.com/questions/767657/how-do-i-create-a-unique-constraint-that-also-allows-nulls
So I'm wondering if there is some way of acheiving conditional unique constrains with fluent nhibernate.