I'm using Subsonic 3.0.0.3 with ActiveRecord, running against a MySQL database. I'm finding that this works fine:
// Approach 1
var db = new testDB();
db.Insert.Into<company>(c => c.name) .Values("Acme") .Execute();
But this crashes:
// Approach 2
company c = new company();
c.name = "Acme";
c.Save();
The crash is not immediate, but on shutdown:
One of the background threads threw exception: System.NullReferenceException: Object reference not set to an instance of an object.
at MySql.Data.MySqlClient.NativeDriver.FetchDataRow(Int32 statementId, Int32 columns)
at MySql.Data.MySqlClient.Driver.FetchDataRow(Int32 statementId, Int32 columns)
at MySql.Data.MySqlClient.Driver.SkipDataRow()
at MySql.Data.MySqlClient.ResultSet.Close()
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlDataReader.Close()
at MySql.Data.MySqlClient.MySqlConnection.Close()
at MySql.Data.MySqlClient.MySqlConnection.Dispose(Boolean disposing)
at System.ComponentModel.Component.Finalize()
Test host process exited unexpectedly.
Given that with approach 1 I can't figure out how to get the newly inserted record ID and with approach 2 it crashes, I'm a little stuck...
Any ideas?