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

Forums / Developing with Sitefinity / Using multiple connection string in data config

Using multiple connection string in data config

2 posts, 0 answered
  1. Anurag
    Anurag avatar
    1 posts
    Registered:
    10 Jul 2013
    10 Jul 2013
    Link to this post
    I have multiple web applications using multiple databases using sitefinity, but now in one of my regional application I have to show content from main application. My question is
    1. can we use use multiple connection string in dataconfig.config as I default connection string name is sitefinity.
    2. If yes, then how we will be using the new connection string

    For eg. in Dataconfig file
    <add connectionString="data source=Regional;UID=myuserid;PWD=mypwd;initial catalog=SitefinityRegionalSite" providerName="System.Data.SqlClient" dbType="MsSql" name="Sitefinity"  />


    <add connectionString="data
    source=MainSite;UID=myuserid;PWD=mypwd;initial catalog=SitefinityMainSite"
    providerName="System.Data.SqlClient" dbType="MsSql" name="SitefinityMainSite" 
    />

    in user control

     using (DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager())
                    {
                        
                        Type teamManagementType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.TeamManagementFinal.Manageteam");
                       
                        var myCollection = dynamicModuleManager.GetDataItems(teamManagementType).Where(i => i.Status == ContentLifecycleStatus.Live && i.Visible == true);
                        
                        
                        foreach (var dataItem in myCollection)
                        {
                            ManagementTeam objMgmtTeam = new ManagementTeam();
                            membername = Convert.ToString(dataItem.GetValue("Name"));
                            if (membername.ToLower() == ceoname.ToLower())
                            {
                                Telerik.Sitefinity.Model.ContentLinks.ContentLink[] lstLink = (Telerik.Sitefinity.Model.ContentLinks.ContentLink[])dataItem.GetValue("ProfileImage");
                                string imageUrl = string.Empty;
                                foreach (var data1 in lstLink)
                                {
                                    imageUrl = data1.ChildItemAdditionalInfo;
                                }
                                if (!string.IsNullOrEmpty(imageUrl))
                                {
                                    profileimagesrc = imageUrl;
                                    objMgmtTeam.ProfileImage = profileimagesrc;
                                }
                                string designationname = Convert.ToString(dataItem.GetValue("Designation"));
                                objMgmtTeam.Name = membername;
                                objMgmtTeam.Designation = designationname;
                                MgmtTeam.Add(objMgmtTeam);
                            }
                        }
                    }

    Telerik.Sitefinity.DynamicTypes.Model.TeamManagementFinal.Manageteam name is same for both main site and regional  site but now I want to show on a regional site page the content of main site.
    Please tell how to bind data in Telerik.Sitefinity.DynamicTypes.Model.TeamManagementFinal.Manageteam from Main site to regional site page control with deiifernt connection string that is specified in dataconfig file.

    Hope I am clear with my question. Pls help me in lil hurry..
  2. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    10 Jul 2013 in reply to Anurag
    Link to this post
    The simplest method to communicate data between the sites would be to use Sitefinity's RESTful WCF Services.
    How to work with the services.
    With the service you can query data from any Object type in Sitefinity including custom modules.   I don't believe having multiple connections strings will be your answer.
2 posts, 0 answered