question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating a module. Db context error

See original GitHub issue

Hi,

I am implementing module and using blog-module as example. Also I know about todo-module and that was made as example for issue aspnetboilerplate/aspnetboilerplate#1476. As I understood, todo-module is fully independent from main abp app (template). Is it right? But I need to use one db and auth stuff within all my modules and template, it is why I use blog-module as sample. I created module, but stucking with db context. There is my db context:

`[AutoRepositoryTypes(
    typeof(IFttRepository<>),
    typeof(IFttRepository<,>),
    typeof(FttRepositoryBase<>),
    typeof(FttRepositoryBase<,>)
)]

public class FttDbContext : AbpZeroDbContext<FttTenant, FttRole, FttUser, FttDbContext>
{
    public FttDbContext(DbContextOptions<FttDbContext> options)
        : base(options)
    {

    }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {

    }

}`

ERROR: CS0311: The type 'DigitalFactory.FTT.Core.Auth.FttRole' cannot be used as type parameter 'TRole' in the generic type or method 'AbpZeroDbContext<TTenant, TRole, TUser, TSelf>'. There is no implicit reference conversion from 'DigitalFactory.FTT.Core.Auth.FttRole' to 'Abp.Authorization.Roles.AbpRole<DigitalFactory.FTT.Core.Auth.FttUser>'

The same error for FttUser. The FttTenant is ok. Declarations of FttUser and FttRole are same as in example and derived from AbpUser<FttUser> and AbpRole<FttUser>.

Could you help me to resolve this please? Is it possible to keep auth stuff (user, role, tenant, stores, managers) on separate module? Going to create library (not module) that will be referenced by all my modules.

I use Core template, not .Net

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ismcagdascommented, May 20, 2019

@prodenx found the problem, it seems like you were using (it is net461):

<PackageReference Include="Abp.Zero.EntityFrameworkCore" Version="4.1.0" />

instead you need to use:

<PackageReference Include="Abp.ZeroCore.EntityFrameworkCore" Version="4.1.0" />

And depend on AbpZeroCoreEntityFrameworkCoreModule instead of AbpZeroEntityFrameworkCoreModule in DigitalFactoryFTTEntityFrameworkCoreModule.cs.

0reactions
prodenxcommented, May 20, 2019

@ismcagdas Thanks a lot. Works. I missed with naming. My bad.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does adding IdentityDbContext into DbContext give ...
However, I get an error on options in public ApplebyContext(DbContextOptions<ApplebyContext> options) : base(options) of: The type 'Appleby.Repo ...
Read more >
No DbContext error after adding Blogging and Docs Module #19
Hi, After creating a new project I tried adding the Blogging and Docs modules using abp add-module Volo.Bloggingand abp add-module Volo.
Read more >
Best Practices in Using the DbContext in EF Core
The DbContext is a singleton class that represents the gateway to all data access, and therefore should not be instantiated more than once....
Read more >
Avoid Wrapping DbContext in Using (and other gotchas)
You can avoid a lot of problems by not putting you Entity Framework or Entity Framework Core DbContext instance in a using statement....
Read more >
microservice service template, ReplaceDbContext causes an ...
In my case I've change my EF repository to use IDbContext instead DbContext. I think the misconfiguration came from AbpSuite, so when you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found