Mysql – It is possible to get MySql working with ASP.Net MVC using the Subsonic template

asp.net-mvcMySQLsubsonic

I've downloaded and installed the latest ASP.Net MVC framework, and installed the Subsonic project template. The template understandably comes installed with support for MS-SQL server only, and I'm wondering if anyone has created version of the .tt template files to cater for a MySql connection?

I've added the MySql connection string to the web.config, but get the following MS-SQL specific error when I try to build the project – so I'm assuming that it's not possible to run MySql with the default install.

    Error   2   Running transformation: System.ArgumentException: Keyword not supported: 'port'.
   at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)
   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value)
   at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
   at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
   at Microsoft.VisualStudio.TextTemplatingBD967F61E201B022A3F2416D8208F609.GeneratedTextTransformation.GetReader(String sql) in c:\SourceCode\Temp\SubSonic MVC Demo\SubSonic MVC Template1\Models\_SQLServer.tt:line 6
   at Microsoft.VisualStudio.TextTemplatingBD967F61E201B022A3F2416D8208F609.GeneratedTextTransformation.LoadTables() in c:\SourceCode\Temp\SubSonic MVC Demo\SubSonic MVC Template1\Models\_SQLServer.tt:line 64
   at Microsoft.VisualStudio.TextTemplatingBD967F61E201B022A3F2416D8208F609.GeneratedTextTransformation.TransformText() in c:\SourceCode\Temp\SubSonic MVC Demo\SubSonic MVC Template1\Models\Context.tt:line 4 C:\SourceCode\Temp\SubSonic MVC Demo\SubSonic MVC Template1\Models\Context.tt   1   1   SubSonic MVC Template1

Best Answer

It's on it's way... I have a new template sitting here in front of me and I'm about to let it go to the wild. It runs SQLite and MySQL as well as SQL Server

Related Topic