Classes
public class ProductType
{
public Guid ID { get; set }
public string Name { get; set }
public ICollection<ProductCategory> Categories { get; set }
}
public class ProductCategory
{
public Guid ID { get; set }
public string Name { get; set }
public ProductType ProductType { get; set; }
}
Configuration
ProductTypeConfiguration
HasMany(p => p.Categories).WithRequired().WillCascadeOnDelete(false);
Question
Note the properties Categories
and ProductType
The relationship is one (ProductType) to many (ProductCategory), however, a ProductCategory
is associated with a single ProductType
!
In my database it is creating two FKS!! How would the configuration (using FluentAPI) for this type of situation??
Thanks!!!