• JavaScriptPHPHTMLCssPythonWordPressWeb developmentLinuxMySQLAndroid
    WindowsJavaC++ / C#LayoutReactUbuntuYiiDjangoProgramming1C-Bitrix
    LaravelSystem administrationTelegramJSONDebianPostgreSQLIOSGoogleHtaccessWindows Server
    GitMacOSGoogle ChromeCMSWooСommerceBootstrapNginxSQLUnityAPI
  • Ask
  • Leaders

Categories

JavaScriptPHPHTMLCssPythonWordPressWeb developmentLinuxMySQLAndroidWindowsJavaC++ / C#LayoutReactUbuntuYiiDjangoProgramming1C-BitrixLaravelSystem administrationTelegramJSONDebianPostgreSQLIOSGoogleHtaccessWindows ServerGitMacOSGoogle ChromeCMSWooСommerceBootstrapNginxSQLUnityAPI
Programming
JavaScript PHP HTML Css Python WordPress Web development Linux MySQL Android Windows Java C++ / C# Layout React Ubuntu Yii Django Programming 1C-Bitrix Laravel System administration Telegram JSON Debian PostgreSQL IOS Google Htaccess Windows Server
Make a leaderReport
A
A
aydep2022-03-09 21:11:44
Entity Framework
aydep, 2022-03-09 21:11:44

How to make a field, besides ID, unique?

Actually how to make any field unique.

Reply
Answer the question

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Report
O
oleg_ods, 2022-03-09
@aydep

In the OnModelCreating method
modelBuilder.Entity().HasIndex(x => x.YourProp).IsUnique();

Similar questions
M
mindgrow2021-10-12 10:03:25
How to update without creating related data of the added entity when joining ManyToMany (EF CORE 5)? 1Reply
N
Nik Faraday2021-11-06 23:56:23
How to add entity to database using Entity Framework Core? 1Reply
O
Oleg2021-11-11 10:30:41
How to link tables that are in different databases? 2Reply
S
Senture2020-08-15 02:33:59
MySQL C# EF LINQ cannot find Russian characters, how to fix? 1Reply
S
Sergey Bezuglov2014-02-14 16:03:48
How to create a copy of a SQL Express database using C# and Entity Framework 6? 1Reply

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question

banners