Catalog Overwriting in Self Servicing project

Posts   
 
    
crustycat
User
Posts: 3
Joined: 12-Mar-2007
# Posted on: 11-Mar-2008 17:53:45   

I hate to be posting this as I see this particular issue has been raised so many times already.

I have a self servicing application that was generated from a catalog named OLD. I am attempting to change the catalog at runtime and am having no success. I've plowed through the posts and have tried recommendation I have found to no avail.

First, is catalog overwriting supported in self servicing?

If so, here is my config file.


<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <configSections>
    <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" />
  </configSections>

  <sqlServerCatalogNameOverwrites>
    <add key="OLD" value="NEW" />
  </sqlServerCatalogNameOverwrites>

  <appSettings>
    <add key="Main.ConnectionString" value="data source=SERVER;initial catalog=NEW;integrated security=SSPI;persist security info=False;packet size=4096"/>
  </appSettings>

</configuration>

I've also tried this method:


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="Main.ConnectionString" value="data source=SERVER;initial catalog=NEW;integrated security=SSPI;persist security info=False;packet size=4096"/>
    <add key="CatalogNameUsageSetting" value="2"/>
    <add key="CatalogNameToUse" value="NEW" />
  </appSettings>
</configuration>

I'm also setting the actual connection string in code:


        private void button1_Click(object sender, EventArgs e)
        {
            DbUtils.SetSqlServerCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2005);
            DbUtils.ActualConnectionString = "data source=SERVER;initial catalog=NEW;integrated security=SSPI;persist security info=False;packet size=4096";
            CompanyEntity c3 = new CompanyEntity();
            c3.FetchUsingPK(1);
            MessageBox.Show(c3.CompanyName);
        }


I've set the company name to "OLD" in the OLD database and "NEW" in the NEW database.

When I run the application, I get a messagebox showing "OLD".

bentos
User
Posts: 146
Joined: 12-Jul-2006
# Posted on: 04-May-2009 19:17:10   

crustycat,

did you fix this? I may be getting a related issue in self servicing and wondering if I am doing something wrong also?

Edit: it was the good old <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" /> which fixed it for me, but was not using integrated security, that may be part of the issue!