// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace System.Data.Entity.Infrastructure
{
using System.Data.Entity.Internal;
using System.Diagnostics.CodeAnalysis;
///
/// Represents a SQL query for entities that is created from a
/// and is executed using the connection from that context.
/// Instances of this class are obtained from the instance for the
/// entity type. The query is not executed when this object is created; it is executed
/// each time it is enumerated, for example by using foreach.
/// SQL queries for non-entities are created using .
/// See for a non-generic version of this class.
///
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public class DbSqlQuery : DbRawSqlQuery
where TEntity : class
{
///
/// Initializes a new instance of the class.
///
/// The internal query.
internal DbSqlQuery(InternalSqlQuery internalQuery)
: base(internalQuery)
{
}
#region AsNoTracking
///
/// Returns a new query where the entities returned will not be cached in the .
///
/// A new query with NoTracking applied.
public DbSqlQuery AsNoTracking()
{
return new DbSqlQuery(InternalQuery.AsNoTracking());
}
#endregion
#region AsStreaming
///
/// Returns a new query that will stream the results instead of buffering.
///
/// A new query with AsStreaming applied.
public new DbSqlQuery AsStreaming()
{
return new DbSqlQuery(InternalQuery.AsStreaming());
}
#endregion
}
}