I have a following code:
public abstract class Entity
{
public virtual int Id { get; set; }
}
public class Category : Entity
{
public string Name { get; set; }
public virtual ICollection<Category> Children { get; set; }
public virtual ICollection<Item> Items { get; set; }
}
public class Item : Entity
{
public string Name { get; set; }
public decimal Price { get; set; }
public DateTime DateCreated { get; set; }
public virtual Category Category { get; set; }
}
This syntax
modelBuilder.Entity<Category>().Property(x => x.Children).HasColumnName("CategoryID");
gives me Severity Code Description Project File Line Error CS0453 The type 'ICollection' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'StructuralTypeConfiguration.Property(Expression>)'
Q: How I can change database column name via Fluent API?