views:

39

answers:

1

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.

A: 

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!

Vlad Lazarenko
Note...I have tried attaching the db in the past and gotten around the "login" issue. I am going to accept your answer becuase this takes care of that part of the problem problem, but I am still having problems with SubSonic and SQL Server Express. The ActiveRecord.cs class that is generated when I left click and click on custom tool is not being generated completely with SSE. Thanks for the help.
AGoodDisplayName