EntityFunctions.Truncate 方法 (Nullable<Decimal>, Nullable<Int32>)

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

作为 LINQ to Entities 查询的一部分使用时,此方法调用规范 Truncate EDM 函数以将指定的值截断为指定的位数。

命名空间:  System.Data.Entity.Core.Objects
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "value")> _
<DbFunctionAttribute("Edm", "Truncate")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "digits")> _
Public Shared Function Truncate ( _
    value As Nullable(Of Decimal), _
    digits As Nullable(Of Integer) _
) As Nullable(Of Decimal)
用法
Dim value As Nullable(Of Decimal)
Dim digits As Nullable(Of Integer)
Dim returnValue As Nullable(Of Decimal)

returnValue = EntityFunctions.Truncate(value, _
    digits)
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value")]
[DbFunctionAttribute("Edm", "Truncate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "digits")]
public static Nullable<decimal> Truncate(
    Nullable<decimal> value,
    Nullable<int> digits
)
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"value")]
[DbFunctionAttribute(L"Edm", L"Truncate")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"digits")]
public:
static Nullable<Decimal> Truncate(
    Nullable<Decimal> value, 
    Nullable<int> digits
)
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value")>]
[<DbFunctionAttribute("Edm", "Truncate")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "digits")>]
static member Truncate : 
        value:Nullable<decimal> * 
        digits:Nullable<int> -> Nullable<decimal> 
public static function Truncate(
    value : Nullable<decimal>, 
    digits : Nullable<int>
) : Nullable<decimal>

参数

返回值

类型:System.Nullable<Decimal>
截整值。

备注

无法直接调用此函数。 此函数只能出现在 LINQ to Entities 查询中。 此函数将被转换为数据库中对应的函数。

请参阅

参考

EntityFunctions 类

Truncate 重载

System.Data.Entity.Core.Objects 命名空间