LineItem上的问题小数 [英] Problem Decimal Quantity on LineItem

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

问题描述

嗨!

我需要能够在LineItem的数量字段中有一个小数值(例如1.5)。

当我尝试创建LineItem时,我得到一个 InvalidOperationException

这是有记录的在http://msdn.microsoft.com/en-us/library/ms949453.aspx中。

它是否真的只能使用整数?如果是soo什么是优先解决方案?

我想这是常见的问题,但我找不到解决方法。

提前谢谢!


问候Ingo

解决方案

这是Commerce Server API的珍珠之一。尽管LineItem接受小数作为数量,但在内部它会转换为整数,因此您只能使用整数作为数量。

您可以尝试将值存储在弱属性中,但是我我不确定你会得到多远。更大的问题是任何基于LineItem进行计算的管道组件。如果你把它放在一个弱属性中,Quantity将看不到你的小数值。

我不知道一个简单的解决方法限制。结果

Hi!

I need to be able to have a decimal value (e.g 1.5) in the quantity field on the LineItem.

When I try to create the LineItem I am getting a InvalidOperationException.

This is documented in http://msdn.microsoft.com/en-us/library/ms949453.aspx.

Is it really true that it can only use whole number? If soo what is the preffered workaround?

I guess that this is common problem but I havn't been able to find a workaround.

Thank in advance!

Best Regards Ingo

解决方案

This is one of the pearls of the Commerce Server API. Even though the LineItem accepts a decimal as a quantity, internally it does a conversion to an integer, so you can only use whole numbers for quantities.

You could try storing the value in a weak property, but I'm not sure how far you would get with this. The bigger problem is any pipeline component that does calculations based on LineItem.Quantity will not see your decimal value, if you put it in a weak property.

I'm not aware of an easy way to work around this limitation.


这篇关于LineItem上的问题小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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