> ## Content Index
> Fetch the complete content index at: https://sgpublic.xyz/llms.txt
> Use this file to discover other available public pages before exploring further.

# Microsoft.EntityFrameworkCore 使用 ExecuteDelete 时报错 Ambiguous invocation
- URL: https://sgpublic.xyz/p/2025/02/6aac9cb1810a480001533606/
- Published: 2025-02-01T03:27:24.000Z
- Updated: 2025-02-01T03:27:24.000Z
- Author: Haven Madray
- Tags: 软件开发, .NET, #wp-post

引用依赖：

- Microsoft.EntityFrameworkCore 9.0.1
- Pomelo.EntityFrameworkCore.MySql 8.0.2

代码：

```c#
            database.TorrentSubs
                .Where(it => it.Id == id)
                .ExecuteDelete();
```

报错：

```
Ambiguous invocation. Candidates are:
     ExecuteDelete(this IQueryable) (in class EntityFrameworkQueryableExtensions)
     ExecuteDelete(this IQueryable) (in class RelationalQueryableExtensions)
```

解决方案：依赖冲突，将 Microsoft.EntityFrameworkCore 降级 8.x 即可