fluent-nhibernate icon indicating copy to clipboard operation
fluent-nhibernate copied to clipboard

Question: Unique() constraint that allow NULLS ?

Open cristian-eriomenco opened this issue 10 years ago • 2 comments

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.

cristian-eriomenco avatar Mar 11 '15 18:03 cristian-eriomenco