SubSonic - 生成的类有以下错误 - KimDal 中不存在类型或命名空间名称
我试图生成我的 dal 并且这有效,但是当我在 Visual Studio 2008 中检查我的代码时,我收到此消息“KimDal 中不存在类型或命名空间名称”
我使用 sql expreess 2005,vs2008 的完整版本,并且我设置了一个新的 C# 2.0 网站。
我安装了 subsonic 的 2.1 安装程序,将其添加到我的外部工具中,添加了对 dll 的引用,将其和其他 dll 添加到了我的 bin 文件夹中。
我还添加了对 system.web 和 system.configuration 的引用,因为我看到这解决了其他人的问题。
我的配置如下,当我查看类时,我在 intelisense 中变得正常的错误是,还是我需要修复某些内容以及如何修复它。
<configuration>
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/>
</configSections>
<appSettings/>
<connectionStrings>
<!-- Development connection string -->
<add name="kimWebApp" connectionString="Data Source=7NQ384J\SQLExpress;Initial Catalog=kim2;Integrated Security=True"/>
</connectionStrings>
<SubSonicService defaultProvider="kimWebAppProvider">
<providers>
<clear/>
<add name="kimWebAppProvider" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="kimWebApp" generatedNamespace="KimDal"/>
</providers>
</SubSonicService>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" defaultLanguage="c#">
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
<system.codedom>
</system.codedom>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
</system.webServer>
</configuration>
Im trying to generate my dal and this works but when i check my code in visual studio 2008 i get this message "the type or namespace name does not exist in KimDal"
Im using sql expreess 2005, full version of vs2008, and i setup a new c# 2.0 website.
I installed the 2.1 installer for subsonic, add added it to my external tools, i added a refernce to the dll which added it and other dlls to my bin folder.
I also addeded references to system.web and system.configuration as i saw somehwere that this resolved someone elses issue.
My config is below, is the error im geting normal within intelisense when i look at the class, or do i need to fix something and how do i fix it.
<configuration>
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/>
</configSections>
<appSettings/>
<connectionStrings>
<!-- Development connection string -->
<add name="kimWebApp" connectionString="Data Source=7NQ384J\SQLExpress;Initial Catalog=kim2;Integrated Security=True"/>
</connectionStrings>
<SubSonicService defaultProvider="kimWebAppProvider">
<providers>
<clear/>
<add name="kimWebAppProvider" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="kimWebApp" generatedNamespace="KimDal"/>
</providers>
</SubSonicService>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" defaultLanguage="c#">
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
<system.codedom>
</system.codedom>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
</system.webServer>
</configuration>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
别担心,我现在可以正常工作,并且能够生成代码,为此,我基本上必须执行以下操作。
创建一个如下所示的 webconfig
我从 subsonic 安装中复制了配置文件 C:\Program Files\SubSonic\SubSonic 2.1 Final\src\SubSonicCentral
根据我的需要进行了更改,然后我添加了对 subsonic 的引用,其中包括下面的所有 dll 。
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.ObjectBuilder.dll
MySql.Data.dll
系统.Data.SQLite.dll
亚音速.dll
Dont worry i now have this working, and was able to generate the code, to do so, i basically had to do the following.
Create a webconfig that looks like this
I copied the config file from my installation of subsonic C:\Program Files\SubSonic\SubSonic 2.1 Final\src\SubSonicCentral
Changed for my needs, i then added the reference to subsonic which included all the dlls below.
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.ObjectBuilder.dll
MySql.Data.dll
System.Data.SQLite.dll
subsonic.dll