Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure the connection string for all functions of a single tenant? #8

Open
china-live opened this issue May 14, 2018 · 1 comment

Comments

@china-live
Copy link

No description provided.

@jeremycook
Copy link
Contributor

@china-live if you are still interested in this please take a look at the "OrchardCore" section https://github.com/OrchardCMS/OrchardCore.Samples/blob/master/MultiTenantApplication/appsettings.json and how it has CustomTitle and CustomSetting properties. Then take a look at https://github.com/OrchardCMS/OrchardCore.Samples/blob/master/MultiTenantApplication/Pages/Index.cshtml and how ShellSettings is injected into the view and used to access the values of CustomTitle and CustomSetting on a per-tenant basis.

In the same way you could have a MyConnectionString property in each tenant and then inject the ShellSetting into your a scoped data access layer (a subclass of DbContext for example) and use that to establish the connection string. How that is done is specific to your data access layer. If you are using EF Core try google "ef core onconfiguring connection string" to get some ideas of how to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants