DbExpressionBuilder.SelectMany Metodo

Definizione

Overload

Nome Descrizione
SelectMany(DbExpression, Func<DbExpression,DbExpression>)

Crea un nuovo DbApplyExpression oggetto che valuta l'espressione specificata apply una volta per ogni elemento di un determinato set di input, generando una raccolta di righe con input corrispondente e applicando colonne. Le righe per cui apply restituisce un set vuoto non sono incluse. Viene DbProjectExpression quindi creato un oggetto che seleziona la apply colonna da ogni riga, producendo la raccolta complessiva dei apply risultati.

SelectMany<TSelector>(DbExpression, Func<DbExpression,DbExpression>, Func<DbExpression,DbExpression,TSelector>)

Crea un nuovo DbApplyExpression oggetto che valuta l'espressione specificata apply una volta per ogni elemento di un determinato set di input, generando una raccolta di righe con input corrispondente e applicando colonne. Le righe per cui apply restituisce un set vuoto non sono incluse. Viene DbProjectExpression quindi creato un oggetto che seleziona l'oggetto specificato selector in ogni riga, producendo la raccolta complessiva dei risultati.

SelectMany(DbExpression, Func<DbExpression,DbExpression>)

Crea un nuovo DbApplyExpression oggetto che valuta l'espressione specificata apply una volta per ogni elemento di un determinato set di input, generando una raccolta di righe con input corrispondente e applicando colonne. Le righe per cui apply restituisce un set vuoto non sono incluse. Viene DbProjectExpression quindi creato un oggetto che seleziona la apply colonna da ogni riga, producendo la raccolta complessiva dei apply risultati.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbProjectExpression ^ SelectMany(System::Data::Common::CommandTrees::DbExpression ^ source, Func<System::Data::Common::CommandTrees::DbExpression ^, System::Data::Common::CommandTrees::DbExpression ^> ^ apply);
public static System.Data.Common.CommandTrees.DbProjectExpression SelectMany(this System.Data.Common.CommandTrees.DbExpression source, Func<System.Data.Common.CommandTrees.DbExpression,System.Data.Common.CommandTrees.DbExpression> apply);
static member SelectMany : System.Data.Common.CommandTrees.DbExpression * Func<System.Data.Common.CommandTrees.DbExpression, System.Data.Common.CommandTrees.DbExpression> -> System.Data.Common.CommandTrees.DbProjectExpression
<Extension()>
Public Function SelectMany (source As DbExpression, apply As Func(Of DbExpression, DbExpression)) As DbProjectExpression

Parametri

source
DbExpression

Oggetto DbExpression che specifica il set di input.

apply
Func<DbExpression,DbExpression>

Metodo che rappresenta la logica da valutare una volta per ogni membro del set di input.

Valori restituiti

Nuovo DbProjectExpression che seleziona la colonna apply da un nuovo DbApplyExpression con l'input specificato e applica associazioni e un DbExpressionKind oggetto CrossApply.

Eccezioni

source o apply è null.

oppure

L'espressione prodotta da apply è null.

source non dispone di un tipo di risultato della raccolta.

oppure

L'espressione prodotta da apply non ha un tipo di raccolta.

Si applica a

SelectMany<TSelector>(DbExpression, Func<DbExpression,DbExpression>, Func<DbExpression,DbExpression,TSelector>)

Crea un nuovo DbApplyExpression oggetto che valuta l'espressione specificata apply una volta per ogni elemento di un determinato set di input, generando una raccolta di righe con input corrispondente e applicando colonne. Le righe per cui apply restituisce un set vuoto non sono incluse. Viene DbProjectExpression quindi creato un oggetto che seleziona l'oggetto specificato selector in ogni riga, producendo la raccolta complessiva dei risultati.

public:
generic <typename TSelector>
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbProjectExpression ^ SelectMany(System::Data::Common::CommandTrees::DbExpression ^ source, Func<System::Data::Common::CommandTrees::DbExpression ^, System::Data::Common::CommandTrees::DbExpression ^> ^ apply, Func<System::Data::Common::CommandTrees::DbExpression ^, System::Data::Common::CommandTrees::DbExpression ^, TSelector> ^ selector);
public static System.Data.Common.CommandTrees.DbProjectExpression SelectMany<TSelector>(this System.Data.Common.CommandTrees.DbExpression source, Func<System.Data.Common.CommandTrees.DbExpression,System.Data.Common.CommandTrees.DbExpression> apply, Func<System.Data.Common.CommandTrees.DbExpression,System.Data.Common.CommandTrees.DbExpression,TSelector> selector);
static member SelectMany : System.Data.Common.CommandTrees.DbExpression * Func<System.Data.Common.CommandTrees.DbExpression, System.Data.Common.CommandTrees.DbExpression> * Func<System.Data.Common.CommandTrees.DbExpression, System.Data.Common.CommandTrees.DbExpression, 'Selector> -> System.Data.Common.CommandTrees.DbProjectExpression
<Extension()>
Public Function SelectMany(Of TSelector) (source As DbExpression, apply As Func(Of DbExpression, DbExpression), selector As Func(Of DbExpression, DbExpression, TSelector)) As DbProjectExpression

Parametri di tipo

TSelector

Tipo di risultato del metodo di selector.

Parametri

source
DbExpression

Oggetto DbExpression che specifica il set di input.

apply
Func<DbExpression,DbExpression>

Metodo che rappresenta la logica da valutare una volta per ogni membro del set di input.

selector
Func<DbExpression,DbExpression,TSelector>

Metodo che specifica come derivare un elemento del set di risultati in base a un elemento dell'input e applicare i set. Questo metodo deve produrre un'istanza di un tipo compatibile con SelectMany e può essere risolto in un oggetto DbExpression. I requisiti di compatibilità per TSelector sono descritti nelle note.

Valori restituiti

Nuovo DbProjectExpression che seleziona il risultato del selettore specificato da un nuovo Oggetto DbApplyExpression con l'input specificato e applica associazioni e un DbExpressionKind oggetto CrossApply.

Eccezioni

sourceo applyselector è null.

oppure

L'espressione prodotta da apply è null.

oppure

Il risultato di selector è Null durante la conversione in DbExpression.

source non dispone di un tipo di risultato della raccolta.

oppure

L'espressione prodotta da apply non ha un tipo di raccolta. non dispone di un tipo di raccolta.

Commenti

Per essere compatibile con SelectMany, TSelector deve essere derivato da DbExpressiono deve essere un tipo anonimo con proprietà derivate da DbExpression. Di seguito sono riportati esempi di tipi supportati per TSelector:

source.SelectMany(x => x.Property("RelatedCollection"), (source, apply) => apply.Property("Name"))

(TSelector è DbPropertyExpression).

source.SelectMany(x => x.Property("RelatedCollection"), (source, apply) => new { SourceName = source.Property("Name"), RelatedName = apply.Property("Name") })

(TSelector è un tipo anonimo con proprietà derivate da DbExpression).

Si applica a