ObjectQuery.GetResultType Metódus

Definíció

A lekérdezés eredménytípusára vonatkozó adatokat ad vissza.

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

Válaszok

A TypeUsage lekérdezés eredménytípusára vonatkozó információkat tartalmazó érték.

Példák

Ez a példa létrehoz egy típust ObjectQuery<T>DbDataRecord , és annak meghatározására használja GetResultType , hogy a visszaadott típus egy sort jelöl-e.

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

A következőre érvényes:

Lásd még