dotnet / dotnet/EntityFramework.Docs

Examples/Details for interfaces of HasCheckConstraint

Open
#1,835 2 comments 0 reactions 0 assignees View on GitHub
area-model-building
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

These two seem strait forward. the second string is just the SQL that represents the constraint.

* HasCheckConstraint(EntityTypeBuilder, String, String)
* HasCheckConstraint<TEntity>(EntityTypeBuilder<TEntity>, String, String)

Q) Are there any limitations to a constraint applied in this way? Are there any limitations based on the Database Target? Such as MySQL vs MSSql.

This DataAnnotation version however, raises a few questions.

* HasCheckConstraint(IConventionEntityTypeBuilder, String, String, Boolean)

1) Which DataAnnotations are supported? Any? Or is there a set of DataAnnotations that are explicitly supported? What about custom DataAnnotations?
2) Are there DataAnnotations that are not supported when using a specific Database Target? MySQL vs MSSql?

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 1bb554ee-fe06-b145-318a-735b1d5f3495
* Version Independent ID: f9bd034e-3c22-c710-80ed-e3f4d1acaac1
* Content: [RelationalEntityTypeBuilderExtensions.HasCheckConstraint Method (Microsoft.EntityFrameworkCore)](https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.relationalentitytypebuilderextensions.hascheckconstraint?view=efcore-3.0#Microsoft_EntityFrameworkCore_RelationalEntityTypeBuilderExtensions_HasCheckConstraint_Microsoft_EntityFrameworkCore_Metadata_Builders_EntityTypeBuilder_System_String_System_String_)
* Content Source: [dotnet/xml/Microsoft.EntityFrameworkCore/RelationalEntityTypeBuilderExtensions.xml](https://github.com/aspnet/EntityFramework.ApiDocs/blob/live/dotnet/xml/Microsoft.EntityFrameworkCore/RelationalEntityTypeBuilderExtensions.xml)
* Product: **ef-core-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **divega**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.