EdmFunctions.Substring Method (DbExpression, DbExpression, DbExpression)

 

Creates a DbFunctionExpression that invokes the canonical 'Substring' function with the specified arguments, which must have a string and integer numeric result types. The result type of the expression is string.

Namespace:   System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder
Assembly:  EntityFramework (in EntityFramework.dll)

public static DbFunctionExpression Substring(
	this DbExpression stringArgument,
	DbExpression start,
	DbExpression length
)

Parameters

stringArgument
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the string from which to extract the substring.

start
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the starting index from which the substring should be taken.

length
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the length of the substring.

Return Value

Type: System.Data.Entity.Core.Common.CommandTrees.DbFunctionExpression

A new DbFunctionExpression that returns the substring of length length from stringArgument starting at start.

Exception Condition
ArgumentNullException

stringArgument, start or length is null.

ArgumentException

No overload of the canonical 'Substring' function accepts arguments with the result types of stringArgument, start and length.

Substring requires that the index specified by start be <b>1-based</b>.