ObjectQuery.GetResultType Methode

Definitie

Retourneert informatie over het resultaattype van de query.

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

Retouren

Een TypeUsage waarde die informatie bevat over het resultaattype van de query.

Voorbeelden

In dit voorbeeld wordt een ObjectQuery<T> type DbDataRecord gemaakt en gebruikt GetResultType om te bepalen of het geretourneerde type een rij vertegenwoordigt.

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

Van toepassing op

Zie ook