简体   繁体   English

我们可以在 EF Core 中使用 FromSql 运行 DDL 脚本吗

[英]Can we run DDL scripts using FromSql in EF Core

I know this is not what intended for, but just want to know FromSql whether we can use like this我知道这不是目的,但只想知道 FromSql 我们是否可以这样使用

_dbContext.Student.FromSql("ALTER TABLE Student ADD Grade varchar(max)")

I just want to push this once to my Azure SQL Test environment (still I am in development phase and dont have direct access to SQL editor), better i could have run Migrations, but some point i had messed with it, have to rely on something else. I just want to push this once to my Azure SQL Test environment (still I am in development phase and dont have direct access to SQL editor), better i could have run Migrations, but some point i had messed with it, have to rely on别的东西。 This is like a temporary fix.这就像一个临时修复。

_dbContext.Database.ExecuteSql("ALTER TABLE Student ADD Grade varchar(max)")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM