TechCohere
  • Home
  • Tech News
  • Tech Tips
  • Search

How EntityFramework Core creates primary key in Database

  • 9/11/2022 9:35 AM

By naming the property name as Class name + Id, Entity Core creates primary key for particular table.

publicclassAuthor

{

        publicint AuthorId { get; set; }

 

        publicstring Name { get; set; }

}

As shown above, we can see the AuthorId property which contains the class name Author plus Id. Because of this Entity Framework Core creates AuthorId as the primary key for the Author table in the database.

tags:

share:

Microsoft Visual Studio 2022 Promo Code
Latest News
  • Microsoft renamed Azure Active Directory (AAD)
  • What is the next Microsoft Visual Studio Version?
  • .NET 7 Release Date
  • C#10 Features
Latest TechTips
  • You will Never get time to clean your messy code
  • What are Azure Storage Types?
  • What is Azure Blob?
  • Enable Multi Repository Feature in Visual Studio 2022
Latest Posts
  • Dictionary vs List Comparison in C#
  • Dynamic component in Blazor with Example
  • Blazor – Cascading Parameters with Example
  • C# 12 Feature - Enhanced using Directives with Example
Categories
  • AngularJS (7)
  • Asp.Net (231)
  • Asp.Net Core (4)
  • Asp.Net MVC (55)
  • Asp.Net Web API (32)
  • AZ-204 Certificate (2)
  • Blazor (15)
  • C#.Net (449)
  • Cryptography (9)
  • Entity Framework Core (2)
  • General (13)
  • Git (5)
  • IIS (5)
  • JavaScript (6)
  • jQuery (28)
  • LINQ (10)
  • Microsoft Azure (35)
  • Microsoft Excel (2)
  • Microsoft Office (42)
  • Microsoft Promo Code (16)
  • Oracle (2)
  • Sharepoint (21)
  • Silverlight (3)
  • SQL Server (12)
  • Terraform (3)
  • Vb.Net (8)
  • WCF (19)
  • WPF (18)
  • Xamarin (10)
  • XML (4)

Privacy Policy | Terms & Conditions

All copyright (C) 2025 Reserved