-
Notifications
You must be signed in to change notification settings - Fork 0
Type Mapping for Query
Akash Kava edited this page Jan 13, 2022
·
2 revisions
Since we are passing parameters as JSON, we don't really have type information and we don't want to add more overhead on clients to specify types for query parameters. We decided to create implicit operators on QueryParameter
type to support json elements conversion to basic types.
The only problem arises when we use custom types and enum.
In order to create compare Enum as string, you have to use CastAs.String
method as shown below.
const methods = [
{
where: ["x => CastAs.String(x.PostType) == @0", "Page"]
}
];
Please make sure to call base.OnModelCreating(modelBuilder)
inside your own OnModelCreating(ModelBuilder modelBuilder)
.