ObjectQuery.GetResultType Metoda

Definicja

Zwraca informacje o typie wyniku zapytania.

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

Zwraca

Wartość zawierająca TypeUsage informacje o typie wyniku zapytania.

Przykłady

W tym przykładzie tworzony jest ObjectQuery<T> typ DbDataRecord i jest używany GetResultType do określania, czy zwracany typ reprezentuje wiersz.

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);
    }
}

Dotyczy

Zobacz też