breeze.Predicate for Decimal Type

假装没事ソ 提交于 2019-12-11 02:58:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!