简体   繁体   English

清风。小数类型的谓词

[英]breeze.Predicate for Decimal Type

is there a way to create a breeze predicate for a property that its type is Edm.Decimal? 有没有一种方法可以为类型为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.53 d ' value instead '10.53 m ' value, then the server answer me with an error. 因为下一个表达式中的数据类型始终为double,并且我没有找到一种方法可以轻松地说我只需要为十进制类型而不是double类型创建谓词,因为在最终的url请求中我得到的是'10 .53 d '值值“ 10.53 m ”,则服务器回答错误。

var p = new breeze.Predicate( 'UnitPrice' , '>=', 10.53); var p = new breeze.Predicate('UnitPrice','> =',10.53);

Thanks in advance. 提前致谢。

You can always explicitly state the dataType in any query like this: 您始终可以在任何查询中显式声明dataType,如下所示:

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. 但是,如果您在客户端上具有EntityType的元数据,则不需要这样做。 In that case, the EntityQuery will, by default, assume that the dataType is what is specified in the metadata for each property. 在这种情况下,默认情况下,EntityQuery将假定dataType是在元数据中为每个属性指定的值。

The only reason that it should assume Double vs Decimal is if no EntityType metadata is available for the specified property. 假定Double vs Decimal的唯一原因是,如果没有EntityType元数据可用于指定的属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM