J
Jeff
Hi
asp.net 3.5
I'm trying to add a custom section to web.config, but get many messages when
I compile the code:
I get 5 messages about "could not find schema":
Could not find schema information for the element 'testgroup'.
Could not find schema information for the element 'testsystem'.
Could not find schema information for the attribute
'defaultConnectionStringName'.
Could not find schema information for the element 'test'.
<configuration>
<configSections>
<sectionGroup name="testgroup">
<section name="testsystem" type="AH.Test.TestSection"/>
</sectionGroup>
</configSections>
<testgroup>
<testsystem defaultConnectionStringName="LocalSqlServer">
<test providerType="AH.Test.DAL.Sql2005Express.TestProvider" />
</testsystem>
</testgroup>
namespace AH.Test
{
public class TestSection : ConfigurationSection
{
[ConfigurationProperty("defaultConnectionStringName", DefaultValue =
"LocalSqlServer")]
public string DefaultConnectionStringName
{
get { return (string)base["defaultConnectionStringName"]; }
set { base["defaultConnectionStringName"] = value; }
}
[ConfigurationProperty("test", IsRequired = true)]
public TestElement Test
{
get { return (TestElement)base["test"]; }
}
}
public class TestElement : ConfigurationElement
{
public TestElement() { }
[ConfigurationProperty("connectionStringName")]
public string ConnectionStringName
{
get { return (string)base["connectionStringName"]; }
set { base["connectionStringName"] = value; }
}
public string ConnectionString
{
get
{
string connStringName =
(string.IsNullOrEmpty(this.ConnectionStringName) ?
Globals.Settings.DefaultConnectionStringName :
this.ConnectionStringName);
return
WebConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
}
}
}
}
any suggestion?
asp.net 3.5
I'm trying to add a custom section to web.config, but get many messages when
I compile the code:
I get 5 messages about "could not find schema":
Could not find schema information for the element 'testgroup'.
Could not find schema information for the element 'testsystem'.
Could not find schema information for the attribute
'defaultConnectionStringName'.
Could not find schema information for the element 'test'.
<configuration>
<configSections>
<sectionGroup name="testgroup">
<section name="testsystem" type="AH.Test.TestSection"/>
</sectionGroup>
</configSections>
<testgroup>
<testsystem defaultConnectionStringName="LocalSqlServer">
<test providerType="AH.Test.DAL.Sql2005Express.TestProvider" />
</testsystem>
</testgroup>
namespace AH.Test
{
public class TestSection : ConfigurationSection
{
[ConfigurationProperty("defaultConnectionStringName", DefaultValue =
"LocalSqlServer")]
public string DefaultConnectionStringName
{
get { return (string)base["defaultConnectionStringName"]; }
set { base["defaultConnectionStringName"] = value; }
}
[ConfigurationProperty("test", IsRequired = true)]
public TestElement Test
{
get { return (TestElement)base["test"]; }
}
}
public class TestElement : ConfigurationElement
{
public TestElement() { }
[ConfigurationProperty("connectionStringName")]
public string ConnectionStringName
{
get { return (string)base["connectionStringName"]; }
set { base["connectionStringName"] = value; }
}
public string ConnectionString
{
get
{
string connStringName =
(string.IsNullOrEmpty(this.ConnectionStringName) ?
Globals.Settings.DefaultConnectionStringName :
this.ConnectionStringName);
return
WebConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
}
}
}
}
any suggestion?