-
Notifications
You must be signed in to change notification settings - Fork 254
Closed
Description
Hello, I have a table entity like this:
class Entity
{
[Column(TypeName = "jsonb")]
public BaseType Config {get;set;}
}
And a number of types derived from BaseType:
public class Derived1 : BaseType { public string StringProp {get;set;} }
public class Derived2 : BaseType { public int IntProp {get;set;} }
... etc you got the idea.
Is this possible to achieve?
I tried to configure a custom ValueConverter<BaseType, JsonDocument> and conversion to JsonDoument was easy.
Conversion from JsonDocument can be tricky as JsonDocument doesn't contain a ContainsKey method or similar but doable.
Missing part is querying as Where(x => ((Dervived)x.Config).IntProp == 1) couldn't be translated.
weitzhandler
Metadata
Metadata
Assignees
Labels
No labels