Horje
The entity type has multiple properties with the [Key] attribute. Code Example
The entity type has multiple properties with the [Key] attribute.
public class NorthwindContext : DbContext
{
     public NorthwindContext(DbContextOptions<NorthwindContext> options):base(options) { }

     public NorthwindContext() { }

     protected override void OnModelCreating(ModelBuilder builder)
     {
         builder.Entity<Relationship>().HasKey(table => new {
         table.FriendId, table.UserId
         });
     }
     public DbSet<Relationship> Relationships { get; set; }
     public DbSet<User> Users { get; set; }
}




Csharp

Related
LINQ query on a DataTable C# Code Example LINQ query on a DataTable C# Code Example
c# .net core memory cache Code Example c# .net core memory cache Code Example
c# try catch with error message Code Example c# try catch with error message Code Example
how to get value from object in c# Code Example how to get value from object in c# Code Example
unity always rotating object Code Example unity always rotating object Code Example

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