Subsonic ActiveRecord 和 SQL Server Express

发布于 2024-09-27 01:44:03 字数 784 浏览 0 评论 0原文

我正在尝试 Subsonic ActiveRecord 来确定我是否想在即将进行的项目中使用它,我得说到目前为止我真的很喜欢它。它与 MS SQL Server 2005 和 2008 配合得很好,但我在使用 T4 模板和 SQL Server Express 时遇到了问题。据我所知,Subsonic 在从我添加到测试 MVC 应用程序的 Server Express 数据库获取架构信息时遇到问题。

有谁知道如何让它与 Server Server Express (不是 Compact) 一起使用,以及 Subsonic 3.0.0.4 是否支持它?

编辑: 这是一个 MVC 应用程序,MyTestDB 位于 App_Data 文件夹中。我尝试了许多不同的连接字符串,但似乎没有任何效果。我使用的最后一个字符串是:

 <connectionStrings> 
    <add name="MyTestDBString" connectionString="server=.\SQLExpress;database=MyTestDB;integrated security=SSPI;User Instance=true" providerName="System.Data.SqlClient"/>
 </connectionstrings>

使用上面的字符串,我在 Visual Studio 的错误列表中收到 SQL 异常,提示 无法打开数据库...登录失败。当我右键单击 .tt 文件并运行自定义工具时,会发生这种情况。

I am trying out Subsonic ActiveRecord to determine if I want to use it on any upcoming projects, and I gotta say I really like it so far. It worked great with MS SQL Server 2005 and 2008, but I am having problems with the T4 Templates and SQL Server Express. From what I can tell, Subsonic is having a problem getting the schema info from the Server Express database that I added to a test MVC app.

Does anyone have info on getting it to work with Server Server Express (not Compact), and whether its even supported in Subsonic 3.0.0.4?

EDIT:
This is an MVC app with MyTestDB in the App_Data folder. I have tried a number of various connection strings but nothing seems to work. The last string I have used is:

 <connectionStrings> 
    <add name="MyTestDBString" connectionString="server=.\SQLExpress;database=MyTestDB;integrated security=SSPI;User Instance=true" providerName="System.Data.SqlClient"/>
 </connectionstrings>

With the above string I am getting an SQL exception in the error list in Visual Studio saying Cannot Open Database... The login failed. This happens when I right click on the .tt files and run a custom tool.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

記柔刀 2024-10-04 01:44:03

您忘记指定要附加到用户 SQL Server 实例的数据库文件。例如:

<connectionStrings>
     <add name="TestVB1.Settings.Database1ConnectionString" 
          connectionString="Data Source=.\SQLEXPRESS;
          AttachDbFilename=|DataDirectory|\Database1.mdf;
          Integrated Security=True;
          User Instance=True"
          providerName="System.Data.SqlClient" />
</connectionStrings>

请参阅打开用户实例连接< /a> 和 使用 Subsonic 构建 ASP.NET MVC 应用程序3.0

希望一切顺利。祝你好运!

You forgot to specify what database file to attach to a User SQL Server Instance. For example:

<connectionStrings>
     <add name="TestVB1.Settings.Database1ConnectionString" 
          connectionString="Data Source=.\SQLEXPRESS;
          AttachDbFilename=|DataDirectory|\Database1.mdf;
          Integrated Security=True;
          User Instance=True"
          providerName="System.Data.SqlClient" />
</connectionStrings>

See Opening a User-Instance Connection and Building your ASP.NET MVC application with Subsonic 3.0.

Hope it works out. Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文