I'm having a similar error to: The property X is of type Y which is not supported by current database provider
but with a slightly different issue:
I have the following classes:
public class Apple
{
public Box Box{ get; set; }
public int R { get => Color.R; set => Color = new Color (value, Color.G, Color.B); }
public int G { get => Color.G set => Color = new Color (Color.R, value, Color.B); }
public int B { get => Color.B set => Color = new Color (Color.R, Color.G, value); }
[NotMapped]
public Color Color { get; set; }
}
public class Box
{
[Key]
public int ID { get; set; }
public IEnumerable<Apple> Apples { get; set; }
}
In the DbContext class:
modelBuilder.Entity<Apple>()
.HasKey(a=> new { a.Box, a.R, a.G, a.B });
But it does not seem to work and gives me the error: "The property 'Apple.Box' is of type 'Box' which is not supported by current database provider. Either change the property CLR type or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'