Metodo DbMigration.Sql
[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]
Aggiunge un'operazione per eseguire un comando SQL. Le API di Entity Framework Migrations non sono progettate per accettare un input fornito da origini non attendibili, ad esempio l'utente finale di un'applicazione. Se viene accettato un input da tali origini, è necessario convalidarlo prima di passarlo alle API in modo da fornire protezione dagli attacchi SQL injection e da altri tipi di attacchi.
Spazio dei nomi: System.Data.Entity.Migrations
Assembly: EntityFramework (in EntityFramework.dll)
Sintassi
'Dichiarazione
<SuppressMessageAttribute("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId := "0#")> _
<SuppressMessageAttribute("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")> _
Protected Friend Sub Sql ( _
sql As String, _
suppressTransaction As Boolean, _
anonymousArguments As Object _
)
'Utilizzo
Dim sql As String
Dim suppressTransaction As Boolean
Dim anonymousArguments As Object
Me.Sql(sql, suppressTransaction, anonymousArguments)
[SuppressMessageAttribute("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = "0#")]
[SuppressMessageAttribute("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void Sql(
string sql,
bool suppressTransaction,
Object anonymousArguments
)
[SuppressMessageAttribute(L"Microsoft.Naming", L"CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = L"0#")]
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1026:DefaultParametersShouldNotBeUsed")]
protected public:
void Sql(
String^ sql,
bool suppressTransaction,
Object^ anonymousArguments
)
[<SuppressMessageAttribute("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = "0#")>]
[<SuppressMessageAttribute("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")>]
member Sql :
sql:string *
suppressTransaction:bool *
anonymousArguments:Object -> unit
function Sql(
sql : String,
suppressTransaction : boolean,
anonymousArguments : Object
)
Parametri
- sql
Tipo: System.String
Comando SQL da eseguire.
- suppressTransaction
Tipo: System.Boolean
Valore che indica se il comando SQL deve essere eseguito all'esterno della transazione usata per il processo di migrazione. Se non si specifica un valore, il comando SQL verrà eseguito all'interno della transazione.
- anonymousArguments
Tipo: System.Object
Argomenti aggiuntivi che possono essere elaborati dai provider. Usare la sintassi del tipo anonimo per specificare argomenti, ad esempio ' new { SampleArgument = "MyValue" }'.