Horje
ef core add OnModelCreating foreign key Code Example
ef core add OnModelCreating foreign key
public override void OnModelCreating(...)
{
    modelBuilder.Entity<Position>()
         // a position has zero or more Employees via property Employees
         .HasMany(position => position.Employees)
         // every Employee has exactly one Position
         .WithRequired(employee => employee.Position)
         // using foreign key Position_id
         .HasForeignKey(employee => employee.Position_Id);
}




Csharp

Related
convert enum to keyvalue Code Example convert enum to keyvalue Code Example
*ngif vs ngif Code Example *ngif vs ngif Code Example
minimize maximize restore wpf buttons Code Example minimize maximize restore wpf buttons Code Example
c# get out of for loop Code Example c# get out of for loop Code Example
building a config object in XML C# Code Example building a config object in XML C# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9