清风。小数类型的谓词 [英] breeze.Predicate for Decimal Type

查看:49
本文介绍了清风。小数类型的谓词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为类型为Edm.Decimal的属性创建微风谓词?

is there a way to create a breeze predicate for a property that its type is Edm.Decimal?

因为下一个表达式中的数据类型始终是双精度型,所以我无法找到一种方法来表示只需要为十进制类型创建谓词而不是双精度型类型,因为在最终的url请求中,我得到的值为'10 .53 d '而不是'10 .53 m ',然后服务器用一个错误回答我。

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 =新风。Predicate('UnitPrice','> =',10.53);

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

先谢谢了。

推荐答案

您始终可以在任何查询中显式声明dataType:

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 });

但是,如果您在客户端上具有EntityType的元数据,则不必这样做。在那种情况下,默认情况下,EntityQuery将假定dataType是在元数据中为每个属性指定的值。

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.

应该假定Double与Decimal的唯一原因是,如果没有EntityType元数据可用于指定的属性。

The only reason that it should assume Double vs Decimal is if no EntityType metadata is available for the specified property.

这篇关于清风。小数类型的谓词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆