ObjectQuery.GetResultType Método

Definição

Retorna informações sobre o tipo de resultado da consulta.

public:
 System::Data::Metadata::Edm::TypeUsage ^ GetResultType();
public System.Data.Metadata.Edm.TypeUsage GetResultType ();
member this.GetResultType : unit -> System.Data.Metadata.Edm.TypeUsage
Public Function GetResultType () As TypeUsage

Retornos

Um valor TypeUsage que contém informações sobre o tipo de resultado da consulta.

Exemplos

Este exemplo cria um ObjectQuery<T> do tipo DbDataRecord e usa GetResultType para determinar se o tipo retornado representa uma linha.

using (AdventureWorksEntities context =
    new AdventureWorksEntities())
{
    string queryString = @"SELECT VALUE product "
    + "FROM AdventureWorksEntities.Products AS product";
    ObjectQuery<DbDataRecord> query =
        new ObjectQuery<DbDataRecord>
            (queryString, context);

    TypeUsage type = query.GetResultType();
    if (type.EdmType is RowType)
    {
        RowType row = type.EdmType as RowType;
        foreach (EdmProperty column in row.Properties)
            Console.WriteLine("{0}", column.Name);
    }
}

Aplica-se a

Confira também