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

Activities of "jatin"

Hello Hikalkan,

Thank you for your answer.

You are right and I have also same idea.

But see the below code that i get it from your asp.net zero sample project.

I have found two files in that you mention connection string name

1) public class MCDbContext : AbpZeroDbContext<Tenant, Role, User> { /* Define an IDbSet for each entity of the application */

    public virtual IDbSet&lt;BinaryObject&gt; BinaryObjects { get; set; }

    /* Setting "Default" to base class helps us when working migration commands on Package Manager Console.
     * But it may cause problems when working Migrate.exe of EF. ABP works either way.         * 
     */
    public MCDbContext()
        : base("Default")
    {

    }

    /* This constructor is used by ABP to pass connection string defined in MCDataModule.PreInitialize.
     * Notice that, actually you will not directly create an instance of MCDbContext since ABP automatically handles it.
     */
    public MCDbContext(string nameOrConnectionString)
        : base(nameOrConnectionString)
    {

    }
}

2) public class MCDataModule : AbpModule { public override void PreInitialize() { //web.config (or app.config for non-web projects) file should containt a connection string named "Default". Configuration.DefaultNameOrConnectionString = "Default"; }

    public override void Initialize()
    {
        IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
    }
}

If project is use connection string name from MCDbContext then our logic will definitely work. but i have checked its always connection string name is using from MCDataModule from PreInitialize() method. Because i have comment code in MCDbContext. then i also application is working.

How can i pass connection string name dynamically in MCDataModule ? or If i can pass connection string name dynamically in MCDbContext then what is the setting in project for enabling get connection string name from MCDbContext not from MCDataModule.

Awaiting for your response.

Thanks, Jatin Gadhiya

Hello,

Any update for me?

Still waiting for anyone response on my query.

Thanks, Jatin

Showing 1 to 2 of 2 entries