EfCore.SoftDeleteServices
EfCore.SoftDeleteServices copied to clipboard
Cannot resolve symbol AddSingleSoftDeleteQueryFilter
Ok, I am baffled. No idea why, but VS2022 refuses to recognize AddSingleSoftDeleteQueryFilter. I get the error "cannot resolve symbol AddSingleSoftDelete"
This is my OnModelCreating
protected override void OnModelCreating(ModelBuilder builder)
{
builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
base.OnModelCreating(builder);
AddStronglyTypedIdConversions(builder);
AddSingleSoftDelete(builder);
AddDecimalPrecision(builder);
}
The AddSingleSoftDelete method reports the same code as in your example
private void AddSingleSoftDelete(ModelBuilder builder)
{
foreach (var entityType in builder.Model.GetEntityTypes())
{
if (typeof(ISingleSoftDelete).IsAssignableFrom(entityType.ClrType))
{
entityType.AddSingleSoftDeleteQueryFilter();
}
}
}
I double checked everything, even tried a previous version of the NuGet package, VS2022 refuses to resolve AddSingleSoftDeleteQueryFilter.
I have also created a ConfigSingleSoftDelete, as explained in your docs, and have zero problems. Any idea on what may be wrong?
Hi @MarcoGaribaldi,
The AddSingleSoftDeleteQueryFilter isn't part of the EfCore.SoftDeleteServices, but you can find the AddSingleSoftDeleteQueryFilter in the SingleQueryFilterExtensions in the DataLayer project. You need to copy that code and put it in your code.
I didn't include the SingleQueryFilterExtensions and CascadeQueryFilterExtensions in the library because I wanted the library allow the developer to do whatever they want to to, but I see it can cause problems. I'm going to leave this issue open and when I next update this library I will move the SingleQueryFilterExtensions and CascadeQueryFilterExtensions classes into the library.