【发布时间】:2011-02-08 19:11:15
【问题描述】:
我在我的 asp.net 项目中使用 MySql。但我不想键入每个“使用 MySql.Data.MySqlClient;”每个 aspx.cs/aspx.vb 文件中的语句。如何在 web.config 文件中定义这些行?
我已经定义了一些命名空间,如下所示,但这仅适用于 aspx 页面:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0"/>
<pages>
<namespaces>
<add namespace="System.Web.Configuration"/>
<add namespace="MySql.Data"/>
<add namespace="MySql.Data.MySqlClient"/>
</namespaces>
</pages>
</system.web>
</configuration>
【问题讨论】:
标签: asp.net .net-4.0 namespaces web-config asp.net-4.0