1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / One website with multiple databases

One website with multiple databases

8 posts, 1 answered
  1. asa Goldberg
    asa Goldberg avatar
    4 posts
    Registered:
    18 May 2010
    18 May 2010
    Link to this post

    Hi,

    I have multiple sites that I need to build and I want to use one sitefinity website and one database for each site,
    in other words I want to have one website in IIS and based on the url (sub domains or domain aliases) connect to a different database, for example I will have 2 host headers setup in IIS for the sitefinity website, a.xxx.com and b.xxx.com. I will have 2 sitefinity databases aDB and bDB, when I logon to a.xxx.com I want the pages to come from the aDB database and when I logon to b.xxx.com I will connect to bDB.
    Is there a way to dynamically change the DB connection/provider on the fly?

    The solution of creating a different page group for each subdomain is not good for me since it uses one database for all sites and I need a separate DB for each site.

    Thanks,

    Asa

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 May 2010
    Link to this post
    Hello asa Goldberg,

    The only way to get this behavior is using Domain Page Mapping feature which works with one database. The page type - group or normal does not matter.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. asa Goldberg
    asa Goldberg avatar
    4 posts
    Registered:
    18 May 2010
    19 May 2010
    Link to this post

    Ivan, thanks for your quick reply,

    Using the "Domain Page Mapping" feature I can manage multiple sites and have each site manage their own pages using the page groups and the permissions (creating new users for each site that can only access their page groups),

    Just like I can manage pages for each site, I need each site to manage their own Generic content items, I need each site to see only their Generic content items, Is there a way to do that?
    I was hoping that I can either manage the permission at the item level or create a new category and assign it the Generic content items and then manage the visibility via permissions so that each site user will see only their categories or content items, but from what I can see there is no way to assign permission at the category level or at the content item level, is there another way to do what I need? (restrict content for each site)

    I have the same problem with News Blogs Lists Polls etc……

    Thanks

    Asa

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 May 2010
    Link to this post
    Hi asa Goldberg,

    Permission per item are implemented in Sitefinity 4.0. Currently you can download CTP release. In 3.7 there is no granularity.  You could try to use the Provider mode as a partial solution, but this could be done per domain name or based on a user role to display some of the items

    Purpose of the Provider Model Design Pattern
    UserManual - page 225 Adding providers section
    Run Multiple Community Editon Sites from one SQL2009 Database?

    The content of all GenericContent based modules is populated by common web service. Generally you could hack the modules and return only the content items that belongs to a single user, so that you will have permissions per content item

    The client side binding mode is described in the posts below

    For backend views like category and tags you will have to override and replace the default views - replacing child views


    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. asa Goldberg
    asa Goldberg avatar
    4 posts
    Registered:
    18 May 2010
    19 May 2010
    Link to this post

    I noticed that there is an "Application" column in the DB and that almost every query filters on that column, is it possible to change the "application" value on the fly in code, I'm wondering if I use that column with a different value for each site.

    Thanks,
    Asa

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 May 2010
    Link to this post
    Hello asa Goldberg,

    If you have providers with different application name declared in the web.config as described in the articles the data in Application column is automatically populated. The Application determines the provider.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. asa Goldberg
    asa Goldberg avatar
    4 posts
    Registered:
    18 May 2010
    19 May 2010
    Link to this post
    Hello Ivan Dimitrov,

    Looks like the providers solution is what I'm looking for, can I have multiple providers in the same web.config file
    something like the code below?
    My second question is how will sitefinity know which connection to use for which site, is there a way I can define a subdomain and point it to the matching connection?

    Thanks,
    Asa

    <cms defaultProvider="Sitefinity" redirectToHomePage="false" pageExtension=".aspx" disabled="false" pageEditorUIMode="Overlay"> 
      <providers> 
        <clear /> 
        <add connectionStringName="DefaultConnection" allowPageHistory="true" allowPageWorkflow="false" cachingProviderName="ASPNET" name="Sitefinity"
          type="Telerik.Cms.Data.DefaultProvider, Telerik.Cms.Data" applicationName="/websiteone" />  
      
        <add connectionStringName="DefaultConnection" allowPageHistory="true" allowPageWorkflow="false" cachingProviderName="ASPNET" name="Sitefinity"
          type="Telerik.Cms.Data.DefaultProvider, Telerik.Cms.Data" applicationName="/websitetwo" />
      
      </providers> 

  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 May 2010
    Link to this post
    Hi asa Goldberg,

    You can have multiple providers in the same web.config and in the same website. The website will pick up the default provider - defaultProvider="Sitefinity". The property connectionStringName specify the connection string the your provider will use.

    If  you have several domains/sudomains you could not control from the configuration which will be the default provider when you use one website. This could be done programmatically. For instance when you are in the backend ( admin)  and access a given module, you can easily pass the provider in the  QueryString depending on the host. Another option is overriding the backend views so that you will calling the default provider internally.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
Register for webinar
8 posts, 1 answered