I'm trying to write a class to the database using entityframework.
public class MyClass
{
[Key]
public long ID {get; set;}
public Type MyType {get;set;}
}
My DbContext
contains a DbSet
of MyClass, but when I try to create the DB,
I get this exception:
System.InvalidOperationException: 'The entity type 'CustomAttributeData' requires a primary key to be defined.'
I'm guessing it's because EF is trying to use the inner structure of System.Type
.
Is there a way to make EF write this field (or any other classes we can't change) to the DB?