ObjectQuery.GetResultType Metode

Definisi

Mengembalikan informasi tentang tipe hasil kueri.

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

Mengembalikan

Nilai TypeUsage yang berisi informasi tentang tipe hasil kueri.

Contoh

Contoh ini membuat ObjectQuery<T> jenis DbDataRecord dan menggunakan GetResultType untuk menentukan apakah jenis yang dikembalikan mewakili baris.

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

Berlaku untuk

Lihat juga