Casbin.NET
Casbin.NET copied to clipboard
Is Casbin.NET v2 incompatible with EFCore Adapter and AspNetCore?
I'm using Casbin.NET v2 in order to take advantage of EnforcerContext (please see #240 for reference.) I've noticed that neither EFCore Adapter nor the AspNetCore extension work with this version of the tool because the assembly name change from CasbinNet to just Casbin.
This is the specific error the compiler is spewing out:
[CS0012] The type 'IFilteredAdapter' is defined in an assembly that is not referenced.
You must add a reference to assembly 'NetCasbin, Version=1.12.1.0, Culture=neutral, PublicKeyToken=null'.
I'm still new to Microsoft's .NET stack and the C# language. It's completely possible that I misunderstood the meaning of this error, but I did notice the namespace change.
Unless there's a way to query query the enforcer for pN rules, I can't afford to downgrade to the previous version of Casbin.NET. Do you have any advice?
The error is happening with this code
var enforcer = new Enforcer(
DefaultModel.CreateFromFile(Path.Combine("CasbinConfig", "model.conf"),
new EFCoreAdapter<int>(_casbinDbContext));
when using the following versions of the Casbin packages:
- Casbin.NET 2.0.0-preview.2
- Casbin.AspNetCore 0.2.1
- Casbin.Adapter.EFCore 1.8.0
@sagilio @xcaptain @huazhikui
@sagilio
The release of Casbin.Adapter.EFCore and Casbin.AspNetCore is only work for Casbin.NET v1.
I will release 2.x versions of them that are compatible with the Casbin.NET v2 this year.
@sagilio any update?
@sociometry
@shayura Casbin.AspNetCore and Casbin.Adapter.EFCore latest versions have supported Casbin.NET 2.x now.