No suitable constructor was found for entity type 'FilterDescriptor'

Joseph Cambron 0 Reputation points
2023-04-21T12:59:02.4+00:00

I have Visual Studio 2022 with a .NET 7 API project in it. I have been building out a set of models and having EntityFramwork build the database in Microsoft Sql Server. That has been going great. Today I added a .NET 7 Web App (MVC) to the solution and now Add-Migration throws this error. This doesn't make sense to me because I don't have a 'FilterDescriptor' class or FilterDescriptor method anywhere in my project. This only started after adding the MVC project. I can remove the MCV project and it works again without a problem. Does anyone have any ideas on how to fix this? No suitable constructor was found for entity type 'FilterDescriptor'. The following constructors had parameters that could not be bound to properties of the entity type: Cannot bind 'filter', 'filterScope' in 'FilterDescriptor(IFilterMetadata filter, int filterScope)' Note that only mapped properties can be bound to constructor parameters. Navigations to related entities, including references to owned types, cannot be bound. API.csproj <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net7.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> </PropertyGroup> <ItemGroup> <Compile Remove="Models\ApplicationUser.cs" /> </ItemGroup> <ItemGroup> <PackageReference Include="BCrypt.Net-Next" Version="4.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.2" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> <PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.6" /> </ItemGroup> </Project> MVC.csproj <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net7.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> </PropertyGroup> </Project>

Developer technologies .NET Entity Framework Core
Developer technologies ASP.NET ASP.NET Core
Developer technologies ASP.NET ASP.NET API
Developer technologies ASP.NET Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.