Open Closed

MultiDbContext problem with OrganizationUnit #7472


0
andmattia created

I move my multi DbContext from AbpDbContext to AbpZeroDbContext<T,R,U> and work fine because I use different class name for each Tenant,Role and User. So now I try to use a OrganizationUnit in 2 dbContext but I cann't do it because AbpZeroCommonDbContext<TRole, TUser> has define

        public virtual IDbSet<OrganizationUnit> OrganizationUnits { get; set; }

I cann't override with different name.. Any way to solve it?

My suggestion is to move OrganizationUnit to TOrganizationUnit so pepole che use in multi DB context without problem


2 Answer(s)
  • 0
    ismcagdas created

    Hi @andmattia

    You can map the OrganizationUnits DbSet to any table you want using fluent configuration, have you tried that ?

  • 0
    andmattia created

    Hi @ismcagdas

    is not my problem. The issue is related to OraganizationUnit is defined on base class of AbpZeroCommonDbContext and I cann't override on second DbContext, for that reason when I use OrganizationUnit Entity on Linq the Linq engine say that already exist an object mappet to dbtable. This problem not happen for user because I can create a TUser (user1 and user2) without issue.

    So if we move to virtual OraganizationUnit I can override it on derived class and prevent this.

    Is it correct?