1

我第一次在我的 C# 桌面应用程序中使用 Mindspace.Lightspeed,但出现错误并且无法连接到数据库。 替代文字

我的 App.config 包含以下代码:

<?xml version="1.0" encoding="utf-8" ?><configuration>
<configSections>
<section name="lightSpeedContext" type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection,Mindscape.LightSpeed" /></configSections><connectionStrings>
<add name="DefectsConStr" connectionString="Data Source=.\sqlexpress2k5;Initial Catalog=Defects;Persist Security Info=True;User ID=sa;Password=123"
  providerName="System.Data.SqlClient" /></connectionStrings>  <lightSpeedContext>
 <add name="Development" connectionStringName="DefectsConStr" dataProvider="SqlServer2005"/> </lightSpeedContext> </configuration>
4

1 回答 1

2

I have managed to reproduce your problem, you need to change your configuration file so that the section name is

lightSpeedContexts and not lightSpeedContext

see my configuration file

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="lightSpeedContexts" type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection,Mindscape.LightSpeed"/>
  </configSections>
  <connectionStrings>
    <add name="Blog" connectionString="Data Source=Blog.dat"/>
  </connectionStrings>
  <lightSpeedContexts>
    <add name="Blog" connectionStringName="Blog" dataProvider="SQLite3" identityMethod="KeyTable" pluralizeTableNames="false"/>
  </lightSpeedContexts>
</configuration>
于 2010-12-03T10:40:03.897 回答