scottksmith95 / LINQKit

LINQKit is a free set of extensions for LINQ to SQL and Entity Framework power users.
MIT License
1.63k stars 163 forks source link

`Index` reference clash after installing LINQKit #202

Closed seoj-trifork closed 3 months ago

seoj-trifork commented 3 months ago

Hey, I have installed LINQKit and now I'm getting the following error:

error CS0104: 'Index' is an ambiguous reference between 'Microsoft.EntityFrameworkCore.IndexAttribute' and 'System.ComponentModel.DataAnnotations.Schema.IndexAttribute' 

, when using Microsoft.EntityFrameworkCore; like this:

[Index("index", Name = "idx")] // Doesn't work
[Microsoft.EntityFrameworkCore.Index("index2", Name = "idx2")] // Works
public class DatabaseEntity
{
...
}

I'm running dotnet 8, with the following packages:

<ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.7" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
    <PackageReference Include="LINQKit" Version="1.3.0" />
</ItemGroup>
seoj-trifork commented 3 months ago

Never mind, I had to use LINQKit.Core instead. That works:

<PackageReference Include="LINQKit.Core" Version="1.2.5" />