I have a class:
class Order
{
public OrderId Id {get;set;}
}
struct OrderId
{
private int readonly id;
public OrderId(int id)
{
this.id = id;
}
}
For some reason, I don't want to use a primitive type for the property.
When I'm trying to save object of this class to Sql Server
through Entity Framework Core
, I get an error:
System.InvalidOperationException: 'The property 'Order.Id' is of type 'OrderId' which is not supported by current database provider. Either change the property CLR type or manually configure the database type for it.'
Question: Is it possible to configure mapping in such a case and how to do it?
This is not supported at present in EF Core (upto version 2.0) For tracking issue and possible work-around see https://github.com/aspnet/EntityFramework/issues/9194