I have a 'model struct
' which is internally a string, but is being used to somewhat similiar to a GUID
.
public struct Token {
private string _value;
private Token(Guid uuid) {
_value = Token.FromGuid(uuid);
}
public static Token FromGuid(Guid uuid) {
// perform 'transformation'
// stuff
// return...
}
// other static methods to create a token...
}
How can I map this entity using Entity Framework 6 Code First? I'm aware that structs are not supported, but a complex type also doesn't seem applicable since the class
doesn't contain any properties.
Structs are not a supported EF type. See ef supported primitives
You will need to use a complex type instead.
modelBuilder.ComplexType<Details>();
[ComplexType]
But consider the alternative using a string and managing the public get/set accordingly