Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

New RAD tool database context question #9012


User avatar
0
acmeware created

How is the new RAD tool multiple dbcontext supposed to be used? I was thinking that it allowed the RAD tool to work against non-inherited dbcontext, but I have to inheret from AbpZeroDbContext in order for the context to be visible in the tool. This then creates all the ABP tables in the secondary database.

As a side question, is it even possible to have a second database keeping all the ABP tables in the default context without the use of a separate module? I have some sensitive data I'd like to store in a separate database but not have to duplicate the entire original database.


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Rich,

    Yes, RAD Tool only works on AspNet Zero Entities. Does your non-abp DbContext contains entities which inherits from Entity class ? For your second question, you can check https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/MultipleDbContextEfCoreDemo

  • User Avatar
    0
    acmeware created

    To confirm the rad tool is only intended to work with AspZeroDbContext, not AbpDbContext, correct?

    Allow me to back up the story a little. I did follow all of the instructions in that link and things seem to be working fine, but I am only just testing a few entities. The second dbcontext was originally setup as AbpDbContext. I was creating the entities using the RAD tool and manually copying them to second dbcontext from the primary AspZeroDbContext. My entities with TenantID seem to work fine and file the data and retrieve.

    Then I saw the enhancement to the rad tool thinking that it now allowed for the AbpDbContext to be used, but it does not. It only seems to allow AspZeroDbContext. As a test I switched my second dbcontext to inherit AspZeroDbContext. My entities with TenantID seem to work just fine even after I delete all the ABP tables. Maybe I was just getting lucky?

    In the end, I would like to use the rad tool to build entities in a separate database without all the extra ABP tables. Is that possible? I can probably research overriding the building of ABP tables, but I am worried that I don’t understand the system well enough to know if this will be a problem later. What are your thoughts? Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Rich,

    We can make an enahancement to make RAD Tool work with AbpDbContext. Could you create an issue on GitHub repository about this https://github.com/aspnetzero/aspnet-zero-core ? For now, you can sure move your non-abp entities to another DbContext but you can't just use RAD Tool at the moment.

  • User Avatar
    0
    acmeware created

    Ill close for now. Thanks for considering an enhancement for this.