Redigera

Dela via


DbExpressionBuilder.New Method

Definition

Creates a new DbNewInstanceExpression.

Overloads

New(TypeUsage, IEnumerable<DbExpression>)

Creates a new DbNewInstanceExpression. If the type argument is a collection type, the arguments specify the elements of the collection. Otherwise the arguments are used as property or column values in the new instance.

New(TypeUsage, DbExpression[])

Creates a new DbNewInstanceExpression. If the type argument is a collection type, the arguments specify the elements of the collection. Otherwise the arguments are used as property or column values in the new instance.

New(TypeUsage, IEnumerable<DbExpression>)

Creates a new DbNewInstanceExpression. If the type argument is a collection type, the arguments specify the elements of the collection. Otherwise the arguments are used as property or column values in the new instance.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbNewInstanceExpression ^ New(System::Data::Metadata::Edm::TypeUsage ^ instanceType, System::Collections::Generic::IEnumerable<System::Data::Common::CommandTrees::DbExpression ^> ^ arguments);
public static System.Data.Common.CommandTrees.DbNewInstanceExpression New (this System.Data.Metadata.Edm.TypeUsage instanceType, System.Collections.Generic.IEnumerable<System.Data.Common.CommandTrees.DbExpression> arguments);
static member New : System.Data.Metadata.Edm.TypeUsage * seq<System.Data.Common.CommandTrees.DbExpression> -> System.Data.Common.CommandTrees.DbNewInstanceExpression
<Extension()>
Public Function New (instanceType As TypeUsage, arguments As IEnumerable(Of DbExpression)) As DbNewInstanceExpression

Parameters

instanceType
TypeUsage

The type of the new instance.

arguments
IEnumerable<DbExpression>

Expressions that specify values of the new instances, interpreted according to the instance's type.

Returns

A new DbNewInstanceExpression with the specified type and arguments.

Exceptions

instanceType or arguments is null, or arguments contains null.

arguments is empty or the result types of the contained expressions do not match the requirements of instanceType (as explained in the remarks section).

Remarks

If instanceType is a collection type then every expression in arguments must have a result type that is promotable to the element type of the instanceType. If instanceType is a row type, arguments must contain as many expressions as there are columns in the row type, and the result type of each expression must be equal or promotable to the type of the corresponding column. A row type that does not declare any columns is invalid. If instanceType is an entity type, arguments must contain as many expressions as there are properties defined by the type, and the result type of each expression must be equal or promotable to the type of the corresponding property.

Applies to

New(TypeUsage, DbExpression[])

Creates a new DbNewInstanceExpression. If the type argument is a collection type, the arguments specify the elements of the collection. Otherwise the arguments are used as property or column values in the new instance.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbNewInstanceExpression ^ New(System::Data::Metadata::Edm::TypeUsage ^ instanceType, ... cli::array <System::Data::Common::CommandTrees::DbExpression ^> ^ arguments);
public static System.Data.Common.CommandTrees.DbNewInstanceExpression New (this System.Data.Metadata.Edm.TypeUsage instanceType, params System.Data.Common.CommandTrees.DbExpression[] arguments);
static member New : System.Data.Metadata.Edm.TypeUsage * System.Data.Common.CommandTrees.DbExpression[] -> System.Data.Common.CommandTrees.DbNewInstanceExpression
<Extension()>
Public Function New (instanceType As TypeUsage, ParamArray arguments As DbExpression()) As DbNewInstanceExpression

Parameters

instanceType
TypeUsage

The type of the new instance.

arguments
DbExpression[]

Expressions that specify values of the new instances, interpreted according to the instance's type.

Returns

A new DbNewInstanceExpression with the specified type and arguments.

Exceptions

instanceType or arguments is null, or arguments contains null.

arguments is empty or the result types of the contained expressions do not match the requirements of instanceType (as explained in the remarks section).

Remarks

If instanceType is a collection type then every expression in arguments must have a result type that is promotable to the element type of the instanceType. If instanceType is a row type, arguments must contain as many expressions as there are columns in the row type, and the result type of each expression must be equal or promotable to the type of the corresponding column. A row type that does not declare any columns is invalid. If instanceType is an entity type, arguments must contain as many expressions as there are properties defined by the type, and the result type of each expression must be equal or promotable to the type of the corresponding property.

Applies to