Hi, I am using the lastest 3.1.2 ABP with .Net core 2.0. Need some urgent help needed.
I am getting this error while adding the migration from the console - The filter expression 'Param_0 => ((Not(Convert(Param_0, ISoftDelete).IsDeleted) OrElse (Convert(Param_0, ISoftDelete).IsDeleted != value(X.Y.EntityFrameworkCore.DbContext).IsSoftDeleteFilterEnabled)) AndAlso ((Convert(Param_0, IMayHaveTenant).TenantId == value(X.Y.EntityFrameworkCore.DbContext).CurrentTenantId) OrElse ((Convert(Param_0, IMayHaveTenant).TenantId == value(X.Y.EntityFrameworkCore.DbContext).CurrentTenantId) == value(X.Y.EntityFrameworkCore.DbContext).IsMayHaveTenantFilterEnabled)))' cannot be specified for entity type 'Role'. A filter may only be applied to the root entity type in a hierarchy.
7 Answer(s)
-
0
Hi @indiaict
what change did you do? Could you share some code that is different from original?
-
0
Hi,
This is a restriction of EF Core Query Filters, <a class="postlink" href="https://docs.microsoft.com/en-us/ef/core/what-is-new/">https://docs.microsoft.com/en-us/ef/core/what-is-new/</a> see limitations under Model-level query filters.
According to this, you shouldn't use IMayHaveTenant and IMustHaveTenant for your child entities. As @alirizaadiyahsi said, probably this is caused by a recent change in your project, can you cehck that ? Did you add Role entity to another entity recently ?
-
0
Hi Guys, Thanks for the reply but atleast for the role entitiy we have not put anything. It just derives from AbpRole
-
0
Hi @indiaict,
I think I coulnd't explain the case very well, sorry for that.
Do you have a usage like this.
public class MyEntity{ ... public Role MyFirstRole {get; set;} ... }
If you don't have such a usage, is it possible for you to send your project to us via email ? If not, we will try to find another way to help you.
-
0
Sorry i have checked but i could not find such entity usage for Role, how can i find ? I cannot share the code :(
-
0
Hi, Any suggestions ?
-
0
Hi @indiaict,
Do you have any custom role entity which is derived from Role entity ? If not, can you share full stack trace of error message ?
But, it is hard for us to help you only with this information.