More in this section

Forums / Developing with Sitefinity / Config API, adding new connection string

Config API, adding new connection string

1 posts, 0 answered
  1. Denis
    Denis avatar
    105 posts
    27 Feb 2009
    23 Feb 2013
    Link to this post


    I tried to add new connection string using API. So far I've for the following:

    var conStrings = Config.Get<DataConfig>().ConnectionStrings;
    if (!conStrings.ContainsKey("Sitefinity4"))
        Config.UpdateSection<DataConfig>(config =>
            config.ConnectionStrings.Add(new ConnStringSettings(<?????>, "Sitefinity4", "data source=localhost;Integrated Security=SSPI;initial catalog=db_name")));

    Is Config.UpdateSection<DataConfig> right function to update DataConfig file? And what should I pass instead <??????>. Thanks, Denis.

1 posts, 0 answered