CompiledQuery 클래스

정의

캐시된 LINQ to Entities 쿼리를 나타냅니다.Represents a cached LINQ to Entities query.

public ref class CompiledQuery sealed
public sealed class CompiledQuery
type CompiledQuery = class
Public NotInheritable Class CompiledQuery
상속
CompiledQuery

예제

다음 예제에서는 DateTimeDecimal 입력 매개 변수를 허용 하 고 주문 날짜가 3 월 8 일 보다 늦은 일련의 주문을 반환 하는 쿼리를 컴파일한 다음 호출 합니다 .이는 주문 날짜가 $300.00 보다 2003입니다.The following example compiles and then invokes a query that accepts DateTime and Decimal input parameters and returns a sequence of orders where the order date is later than March 8, 2003 and the total due is less than $300.00:

static readonly Func<AdventureWorksEntities, DateTime, Decimal, IQueryable<SalesOrderHeader>> s_compiledQuery5 =
    CompiledQuery.Compile<AdventureWorksEntities, DateTime, Decimal, IQueryable<SalesOrderHeader>>(
            (ctx, orderDate, totalDue) => from product in ctx.SalesOrderHeaders
                                          where product.OrderDate > orderDate
                                             && product.TotalDue < totalDue
                                          orderby product.OrderDate
                                          select product);

static void CompiledQuery5()
{
    using (AdventureWorksEntities context = new AdventureWorksEntities())
    {
        DateTime date = new DateTime(2003, 3, 8);
        Decimal amountDue = 300.00M;

        IQueryable<SalesOrderHeader> orders = s_compiledQuery5.Invoke(context, date, amountDue);

        foreach (SalesOrderHeader order in orders)
        {
            Console.WriteLine("ID: {0} Order date: {1} Total due: {2}", order.SalesOrderID, order.OrderDate, order.TotalDue);
        }
    }
}
ReadOnly s_compQuery5 = _
   CompiledQuery.Compile(Of AdventureWorksEntities, DateTime, Decimal, IQueryable(Of SalesOrderHeader))( _
                Function(ctx, orderDate, totalDue) From product In ctx.SalesOrderHeaders _
                                                   Where product.OrderDate > orderDate _
                                                      And product.TotalDue < totalDue _
                                                   Order By product.OrderDate _
                                                   Select product)
Sub CompiledQuery5()

    Using context As New AdventureWorksEntities()

        Dim orderedAfterDate As DateTime = New DateTime(2003, 3, 8)
        Dim amountDue As Decimal = 300.0

        Dim orders As IQueryable(Of SalesOrderHeader) = _
            s_compQuery5.Invoke(context, orderedAfterDate, amountDue)

        For Each order In orders
            Console.WriteLine("ID: {0} Order date: {1} Total due: {2}", _
                              order.SalesOrderID, order.OrderDate, order.TotalDue)
        Next

    End Using
End Sub

설명

쿼리를 다시 사용할 수 있도록 컴파일 및 캐시합니다.Provides for compilation and caching of queries for reuse. 개념적으로이 클래스는 Compile 여러 오버 로드를 포함 하는 단일 메서드를 포함 합니다.Conceptually this class contains a single Compile method with several overloads. 메서드를 호출 하 여 Compile 컴파일된 쿼리를 나타내는 새 대리자를 만듭니다.You call the Compile method to create a new delegate to represent the compiled query. 대리자는 ObjectContext 입력 매개 변수 및 다른 매개 변수 값을 사용 하 여 호출 될 때 인스턴스 등의 일부 결과를 생성 합니다 IQueryable<T> .The delegate, when invoked with the ObjectContext input parameter and other parameter values, produces some result (such as an IQueryable<T> instance). 대리자가 처음 호출 될 때 쿼리를 변환 하 고 캐시 합니다.The query is translated and cached when the delegate is invoked for the first time.

메서드

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TArg13,TArg14,TArg15,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TArg13,TArg14,TArg15,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TArg13,TArg14,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TArg13,TArg14,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TArg13,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TArg13,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TArg12,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TArg11,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TArg10,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TArg9,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TArg8,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TArg7,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TArg6,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TArg5,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TArg4,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TArg4,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TArg3,TResult>(Expression<Func<TArg0,TArg1,TArg2,TArg3,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TArg2,TResult>(Expression<Func<TArg0,TArg1,TArg2,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TArg1,TResult>(Expression<Func<TArg0,TArg1,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Compile<TArg0,TResult>(Expression<Func<TArg0,TResult>>)

컴파일된 LINQ to Entities 쿼리를 나타내는 새 대리자를 만듭니다.Creates a new delegate that represents the compiled LINQ to Entities query.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(다음에서 상속됨 Object)

적용 대상

추가 정보