I have the following NON-bindable action configuration on Product entity:
ActionConfiguration extendSupportAction = new ActionConfiguration(modelBuilder, "ExtendSupport");
extendSupportAction.Parameter<DateTime>("newSupportedUntilDate");
extendSupportAction.ReturnsFromEntitySet<ProductFamily>("ProductFamilies");
NOTE: I am returning ProductFamily entity record as return type
My method in controller:
public ProductFamily ExtendSupport(int parentId, ODataActionParameters actionParams)
Result:
Error during formatter write. The exception is "Object does not match target type."
NOTE:
This scenario works fine if i create a BINDABLE action configuration with the same parameter and return type mentioned above. The return type value shouldn't depend on the bindability of the paramater.
My Request:
POST http://kirandesktop:50231/Products(49)/ExtendSupport HTTP/1.1
User-Agent: Fiddler
Accept: application/json;odata=verbose
Content-Type: application/json;odata=verbose
Host: kirandesktop:50231
Content-Length: 47
{"newSupportedUntilDate":"2021-12-31T00:00:00"}
Comments: If it is Not bindable why is there a parameter parentId parameter in the Action? NonBindable accounts are only available on the root of the service. i.e. /server/service/Action Now you probably need to create a ROUTE that look finds this action, but that should be trivial?
ActionConfiguration extendSupportAction = new ActionConfiguration(modelBuilder, "ExtendSupport");
extendSupportAction.Parameter<DateTime>("newSupportedUntilDate");
extendSupportAction.ReturnsFromEntitySet<ProductFamily>("ProductFamilies");
NOTE: I am returning ProductFamily entity record as return type
My method in controller:
public ProductFamily ExtendSupport(int parentId, ODataActionParameters actionParams)
Result:
Error during formatter write. The exception is "Object does not match target type."
NOTE:
This scenario works fine if i create a BINDABLE action configuration with the same parameter and return type mentioned above. The return type value shouldn't depend on the bindability of the paramater.
My Request:
POST http://kirandesktop:50231/Products(49)/ExtendSupport HTTP/1.1
User-Agent: Fiddler
Accept: application/json;odata=verbose
Content-Type: application/json;odata=verbose
Host: kirandesktop:50231
Content-Length: 47
{"newSupportedUntilDate":"2021-12-31T00:00:00"}
Comments: If it is Not bindable why is there a parameter parentId parameter in the Action? NonBindable accounts are only available on the root of the service. i.e. /server/service/Action Now you probably need to create a ROUTE that look finds this action, but that should be trivial?