如何在Linq-to-Entities中运行“重新配置”?

时间:2019-03-13 23:39:53

标签: c# sql-server entity-framework

我正在通过Linq-to-Entities使用SQL Server。

我需要更改Sql配置并重新配置,但是使用Linq-to-Entities,它无法运行。

    entity.Database.ExecuteSqlCommand(@"
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
EXEC sp_configure 'clr enabled', 1
RECONFIGURE
    ");

它显示如下。

  

SqlException:CONFIG语句不能在用户事务内使用。

我是否可以通过实体运行此查询?

0 个答案:

没有答案