Get the Entity Framework Connection String

前端 未结 11 1154
迷失自我
迷失自我 2021-01-31 02:27

We use Entity Framework 5, but have a requirement to ALSO use a normal database connection from the application for some custom SQL we need to perform.

So, I am creating

11条回答
  •  渐次进展
    2021-01-31 03:27

    In my case I just needed to execute an update statement so I used the following construct

    _db.Database.ExecuteSqlCommand($"update ChiusureTurni set esportato = 1 where idChiusuraTurni = {idChiusura}");
    

    where _db is my db context in this case I took advatage of transaction management

提交回复
热议问题