Since Web API OData V5.5, it supports open type and dynamic property on un-type scenario, dynamic properties can be:
- Primitive Type
- Enum Type
- Complex Type
- Collection of above
Let’s see a sample about this feature.
Build un-type Edm Model
Now, we can build the Edm Model as:
If the dynamic property is not primitive type, you should declare it in model like the code above.
GET an untyped open entity with dynamic property
Routing
In the UntypedSimpleOpenCustomersController
, add the following method:
Request Samples
We can get the entity as:
POST an untyped open entity with dynamic property
Routing
In the UntypedSimpleOpenCustomersController
, add the following method :
Request Samples
You should declare the type of dynamic properties in request body.
Payload:
Url:
The type of dynamic properties in un-type scenario
EdmEntityObject (Collection)
Represent an entity.
EdmComplexObject (Collection)
Represent an complex property.
Represent an enum property.