问题
is there a way to create a breeze predicate for a property that its type is Edm.Decimal?
because the datatype in next expression is always double and I don't find a way to say to breeze that I just need create a predicate for a decimal type and not double type, because in final url request I got '10.53d' value instead '10.53m' value, then the server answer me with an error.
var p = new breeze.Predicate( 'UnitPrice' , '>=', 10.53);
Thanks in advance.
回答1:
You can always explicitly state the dataType in any query like this:
var p = new breeze.Predicate('UnitPrice', ">=",
{ value: 10.53, dataType: breeze.DataType.Decimal });
However, this shouldn't be necessary if you have the metadata for the EntityType available on the client. In that case, the EntityQuery will, by default, assume that the dataType is what is specified in the metadata for each property.
The only reason that it should assume Double vs Decimal is if no EntityType metadata is available for the specified property.
来源:https://stackoverflow.com/questions/27609998/breeze-predicate-for-decimal-type