Last active
February 21, 2022 11:56
-
-
Save lucasapoena/cc774adce4c9302e3b33880ad3955fd0 to your computer and use it in GitHub Desktop.
Relacionamento Many-to-Many no Entity Framework 3.1 (EF Core 3.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace Example.Dotnet | |
{ | |
public class Product | |
{ | |
public long ProductId { get; set; } | |
public string Name { get; set; } | |
public virtual ICollection<ProductCategory> ProductCategories { get; set; } | |
} | |
public class Category | |
{ | |
public long CategoryId { get; set; } | |
public string Name { get; set; } | |
public virtual ICollection<ProductCategory> ProductCategories { get; set; } | |
} | |
public class ProductCategory | |
{ | |
public int ProductId { get; set; } | |
public int CategoryId { get; set; } | |
public virtual Product Product { get; set; } | |
public virtual Category Category { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment