EntityFramework-Reverse-POCO-Code-First-Generator
EntityFramework-Reverse-POCO-Code-First-Generator copied to clipboard
Unique Filtered Index issue
If you have an Unique Index on a table:
CREATE UNIQUE INDEX [NameOfTheIndex] ON [TableName] ([Identifier])
It will be handled in the POCO's ModelConfiguration like:
builder.HasAlternateKey(x => x.Identifier).HasName("NameOfTheIndex");
Which is great, if it´s just a plain Unique Index. But if it´s a Filtered Index with uniqueness like:
CREATE UNIQUE INDEX [NameOfIndex] ON [TableName] ([Identifier]) WHERE [IsPrimary] = 1
You´ll get a Runtime Error if you insert more than one element with the same identifier, which is not what I´m trying to achieve.
Is it possible to exclude Unique Indexes with filters from being handled at all?
Best regards,
Thomas
Thank @thbaan Grab the latest code. I removed has alternate key as you can't edit the field marked with that as entity framework makes it read only.