Прочитај на енглеском Уреди

Делите путем


ObjectQuery.GetResultType Method

Definition

Returns information about the result type of the query.

C#
public System.Data.Metadata.Edm.TypeUsage GetResultType();

Returns

A TypeUsage value that contains information about the result type of the query.

Examples

This example creates an ObjectQuery<T> of type DbDataRecord and uses GetResultType to determine whether the type returned represents a row.

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

Applies to

Производ Верзије
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also