Mappage de méthodes CLR à des fonctions canoniques

Certaines méthodes CLR sont converties en fonctions canoniques d'arborescence de commandes, qui peuvent être exécutées sur la base de données. Si une méthode CLR ne peut pas être mappée à une fonction canonique d'arborescence de commandes, une exception est levée lors de la traduction.

Mappage de la méthode System.String (statique)

Méthode System.String (statique) Fonction canonique

System.String Concat(String str0, String str1)

Concat(str0, str1)

System.String Concat(String str0, String str1, String str2)

Concat(Concat(str0, str1), str2)

System.String Concat(String str0, String str1, String str2, String str03)

Concat(Concat(Concat(str0, str1), str2), str3)

Boolean Equals(String a, String b)

= operator

Boolean IsNullOrEmpty(String value)

(IsNull(value)) OR Length(value) = 0

Boolean op_Equality(String a, String b)

= operator

Boolean op_Inequality(String a , String b)

= operator

Microsoft.VisualBasic.Strings.Trim(String str)

Trim(str)

Microsoft.VisualBasic.Strings.LTrim(String str)

Ltrim(str)

Microsoft.VisualBasic.Strings.RTrim(String str)

Rtrim(str)

Microsoft.VisualBasic.Strings.Len(String expression)

Length(expression)

Microsoft.VisualBasic.Strings.Left(String str, Int32 Length)

Left(str, Length)

Microsoft.VisualBasic.Strings.Mid(String str, Int32 Start, Int32 Length)

Substring(str, Start, Length)

Microsoft.VisualBasic.Strings.Right(String str, Int32 Length)

Right(str, Length)

Microsoft.VisualBasic.Strings.UCase(String Value)

ToUpper(Value)

Microsoft.VisualBasic.Strings.LCase(String Value)

ToLower(Value)

Mappage de la méthode System.String (d'instance)

Méthode System.String (d'instance) Fonction canonique Remarques

Boolean Contains(String value)

IndexOf(this, value) > 0

Boolean EndsWith(String value)

Right(this, length(value)) = value

Boolean StartsWith(String value)

IndexOf(this, value) = 1

Int32 get_Length()

Length(this)

Int32 IndexOf(String value)

IndexOf(this, value) - 1

System.String Insert(Int32 startIndex, String value)

Concat(Concat(Substring(this, 1, startIndex), value), Substring(this, startIndex+1, Length(this) - startIndex))

System.String Remove(Int32 startIndex)

Substring(this, 1, startIndex)

System.String Remove(Int32 startIndex, Int32 count)

Concat(Substring(this, 1, startIndex) , Substring(this, startIndex + count +1, Length(this) - (startIndex + count)))

La méthode Remove(startIndex, count) n'est prise en charge que si count est un entier supérieur ou égal à 0.

System.String Replace(String oldValue, String newValue)

Replace(this, oldValue, newValue)

System.String Substring(Int32 startIndex)

Substring(this, startIndex +1, Length(this) - startIndex)

System.String Substring(Int32 startIndex, Int32 length)

Substring(this, startIndex +1, length)

System.String ToLower()

ToLower(this)

System.String ToUpper()

ToUpper(this)

System.String Trim()

Trim(this)

System.String TrimEnd(Char[] trimChars)

RTrim(this)

System.String TrimStart(Char[]trimChars)

LTrim(this)

Boolean Equals(String value)

= operator

Mappage de la méthode System.DateTime (statique)

Méthode System.DateTime (statique) Fonction canonique Remarques

Boolean Equals(DateTime t1, DateTime t2)

= operator

System.DateTime get_Now()

CurrentDateTime()

System.DateTime get_UtcNow()

CurrentUtcDateTime()

Boolean op_Equality(DateTime d1, DateTime d2)

= operator

Boolean op_GreaterThan(DateTime t1, DateTime t2)

> operator

Boolean op_GreaterThanOrEqual(DateTime t1, DateTime t2)

>= operator

Boolean op_Inequality(DateTime t1, DateTime t2)

= operator

Boolean op_LessThan(DateTime t1, DateTime t2)

< operator

Boolean op_LessThanOrEqual(DateTime t1, DateTime t2)

<= operator

Microsoft.VisualBasic.DateAndTime.DatePart( _

ByVal Interval As DateInterval, _

ByVal DateValue As DateTime, _

Optional ByVal FirstDayOfWeekValue As FirstDayOfWeek = VbSunday, _

Optional ByVal FirstWeekOfYearValue As FirstWeekOfYear = VbFirstJan1 _

) As Integer

Consultez la section concernant la fonction DatePart pour plus d'informations.

Microsoft.VisualBasic.DateAndTime.Now

CurrentDateTime()

Microsoft.VisualBasic.DateAndTime.Year(DateTime TimeValue)

Year()

Microsoft.VisualBasic.DateAndTime.Month(DateTime TimeValue)

Month()

Microsoft.VisualBasic.DateAndTime.Day(DateTime TimeValue)

Day()

Microsoft.VisualBasic.DateAndTime.Hour(DateTime TimeValue)

Hour()

Microsoft.VisualBasic.DateAndTime.Minute(DateTime TimeValue)

Minute()

Microsoft.VisualBasic.DateAndTime.Second(DateTime TimeValue)

Second()

Mappage de la méthode System.DateTime (d'instance)

Méthode System.DateTime (d'instance) Fonction canonique

Boolean Equals(DateTime value)

= operator

Int32 get_Day()

Day(this)

Int32 get_Hour()

Hour(this)

Int32 get_Millisecond()

Millisecond(this)

Int32 get_Minute()

Minute(this)

Int32 get_Month()

Month(this)

Int32 get_Second()

Second(this)

Int32 get_Year()

Year(this)

Mappage de la méthode System.DateTimeOffset (d'instance)

Mappage de la méthode System.DateTimeOffset (d'instance) Fonction canonique Remarques

Int32 get_Day()

Day(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Hour()

Hour(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Millisecond()

Millisecond(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Minute()

Minute(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Month()

Month(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Second()

Second(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Year()

Year(this)

Non pris en charge dans SQL Server 2005.

Mappage de la méthode System.DateTimeOffset (statique)

Mappage de la méthode System.DateTimeOffset (statique) Fonction canonique Remarques

System.DateTimeOffset get_Now()

CurrentDateTimeOffset()

Non pris en charge dans SQL Server 2005.

Mappage de la méthode System.TimeSpan (d'instance)

Mappage de la méthode System.TimeSpan (d'instance) Fonction canonique Remarques

Int32 get_Hours()

Hour(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Milliseconds()

Millisecond(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Minutes()

Minute(this)

Non pris en charge dans SQL Server 2005.

Int32 get_Seconds()

Second(this)

Non pris en charge dans SQL Server 2005.

Fonction DatePart

La fonction DatePart est mappée à l'une des diverses fonctions canoniques, en fonction de la valeur de Interval. Le tableau suivant présente le mappage de la fonction canonique pour les valeurs de Interval prises en charge :

Valeur d'intervalle Fonction canonique

DateInterval.Year

Year()

DateInterval.Month

Month()

DateInterval.Day

Day()

DateInterval.Hour

Hour()

DateInterval.Minute

Minute()

DateInterval.Second

Second()

Mappage de fonctions mathématiques

Méthode CLR Fonction canonique

System.Decimal.Ceiling(Decimal d)

Ceiling(d)

System.Decimal.Floor(Decimal d)

Floor(d)

System.Decimal.Round(Decimal d)

Round(d)

System.Math.Ceiling(Decimal d)

Ceiling(d)

System.Math.Floor(Decimal d)

Floor(d)

System.Math.Round(Decimal d)

Round(d)

System.Math.Ceiling(Double a)

Ceiling(a)

System.Math.Floor(Double a)

Floor(a)

System.Math.Round(Double a)

Round(a)

Mappage d'opérateurs de bits

Opérateur de bits Fonction canonique pour les opérandes non booléens Fonction canonique pour les opérandes booléens

Opérateur de bits AND

BitWiseAnd

op1 AND op2

Opérateur de bits OR

BitWiseOr

op1 OR op2

Opérateur de bits NOT

BitWiseNot

NOT(op)

Opérateur de bits XOR

BitWiseXor

((op1 AND NOT(op2)) OR (NOT(op1) AND op2))

Voir aussi

Autres ressources

Référence (LINQ to Entities)