Language

RelationalQueryableExtensions.FromSqlInterpolated<TEntity> メソッド

定義

注意事項

Use FromSql() instead. This method is obsolete and will be removed in a future release.

SQL クエリを表す挿入文字列に基づいて LINQ クエリを作成します。

public static System.Linq.IQueryable<TEntity> FromSqlInterpolated<TEntity>(this Microsoft.EntityFrameworkCore.DbSet<TEntity> source, FormattableString sql) where TEntity : class;
[System.Obsolete("Use FromSql() instead. This method is obsolete and will be removed in a future release.")]
public static System.Linq.IQueryable<TEntity> FromSqlInterpolated<TEntity>(this Microsoft.EntityFrameworkCore.DbSet<TEntity> source, FormattableString sql) where TEntity : class;
static member FromSqlInterpolated : Microsoft.EntityFrameworkCore.DbSet<'Entity (requires 'Entity : null)> * FormattableString -> System.Linq.IQueryable<'Entity (requires 'Entity : null)> (requires 'Entity : null)
[<System.Obsolete("Use FromSql() instead. This method is obsolete and will be removed in a future release.")>]
static member FromSqlInterpolated : Microsoft.EntityFrameworkCore.DbSet<'Entity (requires 'Entity : null)> * FormattableString -> System.Linq.IQueryable<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function FromSqlInterpolated(Of TEntity As Class) (source As DbSet(Of TEntity), sql As FormattableString) As IQueryable(Of TEntity)

型パラメーター

TEntity

sourceの要素の型。

パラメーター

source
DbSet<TEntity>

挿入文字列 SQL クエリのベースとして使用する IQueryable<T> (通常は DbSet<TEntity>)。

sql
FormattableString

パラメーターを含む SQL クエリを表す挿入文字列。

戻り値

IQueryable<TEntity>

挿入文字列 SQL クエリを表す IQueryable<T> 。

属性

注釈

指定された SQL での作成がデータベース プロバイダーでサポートされている場合は、LINQ 演算子を使用して生の SQL クエリの上に作成できます。

SQL を受け入れる API と同様に、SQL インジェクション攻撃から保護するためにユーザー入力をパラメーター化することが重要です。 SQL クエリ文字列には、挿入パラメーターのプレース ホルダーを含めることができます。 指定した補間パラメーター値は、自動的に DbParameterに変換されます。

詳細と例については、 EF Core を使用した生 SQL コマンドの実行 を参照してください。

適用対象