ObjectQuery.GetResultType Metod

Definition

Returnerar information om frågans resultattyp.

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

Returer

Ett TypeUsage värde som innehåller information om frågans resultattyp.

Exempel

Det här exemplet skapar en ObjectQuery<T> typ DbDataRecord och används GetResultType för att avgöra om den typ som returneras representerar en rad.

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

Gäller för

Se även