I'm not experienced in SQL. I have two tables in my .net core project; categories and products. Obviously, there's a one-to-many relationship between the tables. I know the best way to connect the tables is to use a foreign key. a property like CategoryId in products with reference to Id in Categories table. But this project is being created for a third party company. I have to define an admin panel in the website, so they can add or modify products and categories. Is there any way to connect the two tables through a property like CategoryName. I mean there's a drop-down menu for them to choose the category while adding a product.
public class Category : BaseClass
{
public string CategoryName { get; set; }
[NotMapped]
public IFormFile Picture { get; set; }
public List<Product> Products { get; set; }
}
public class Product : BaseClass
{
public string ProductName { get; set; }
[NotMapped]
public string Description { get; set; }
public double Price { get; set; }
public int Quantity { get; set; }
[NotMapped]
public IFormFile Picture { get; set; }
public string DescriptionFileName { get; set; }
public Category Category { get; set; }
}