Is it possible to add a CHECK constraint using the free API in EF7?

Is it possible to add a CHECK constraint using the free API in Entity Framework 7?

I need to get something like this:

...
ADD CONSTRAINT CK_SomeTable_SomeColumn CHECK (SomeColumn >= X);

This is normal if the solution is specific to the provider - I only target MsSqlServer (at least for now).

+4
source share
1 answer

Compared to EF 7.0.0-rc1, this is not possible using the free API.

You can define the restriction manually in the migration section.

migrationBuilder.Sql("ADD CONSTRAINT CK_SomeTable_SomeColumn CHECK (SomeColumn >= X);");
+9
source

Source: https://habr.com/ru/post/1619658/


All Articles