我已添加devart linqconnect ORM
以连接到mysql database
。虽然它是试用版,
我在我的应用程序中创建了一个shopping.iqml
文件,该文件会自动为linq to mysql
创建一个模型。
当我写using shoppingdatacontext;
时,它可以工作并显示在intellisense菜单中,但是,
当我从工具栏添加linq datasource
时,当我配置数据源并尝试选择数据上下文shoppingDataContext
时,不会出现在下拉列表中。
当我尝试手动编写linqdatasource的上下文菜单类型属性(然后出现在configure datasource下拉列表中)并尝试配置它时,它给了我一个错误:
the Type 'ShoppingContext.ShoppingDataContext' could not be loaded. If the type is located in the App_code folder, please check that it compiles. If the type is located in a compiled assemblies, please check that the assembly is referenced by the project.
我试图从项目中添加程序集仍然无法正常工作并尝试其他方法无济于事。 我没办法 .. 请有人帮我解决这个问题..
我的Web.config文件是:
<configuration>
<connectionStrings>
<remove name="LocalMySqlServer" />
<add name="LocalMySqlServer" connectionString="Server=localhost; Database=shopping; uid=root; pwd=007;"
providerName="MySql.Data.MySqlClient" />
<add name="ShoppingDataContextConnectionString" connectionString="User Id=root;Password=007;Host=localhost;Database=shopping;Persist Security Info=True" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Devart.Data.Linq.Web, Version=4.1.197.0, Culture=neutral, PublicKeyToken=09AF7300EEC23701"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="Devart.Data.Linq, Version=4.1.197.0, Culture=neutral, PublicKeyToken=09AF7300EEC23701"/>
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
<add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.5.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requireQuestionAndAnswer="false" requireUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="0" passwordStrengthRegularExpression="" applicationName="/" autogenerateschema="true"/>
</providers>
</membership>
感谢您的帮助..提前感谢..
答案 0 :(得分:1)
将Devart LinqConnect模型添加到项目后,应构建应用程序以使所有更改生效。在构建它之后,在为LinqDataSource配置数据源时,“shoppingdatacontext”将在下拉列表中可用。