I'm trying to run SchemaExport to generate my DB schema, and I have separate HBM mapping files for my classes: Event, EventInvitation, Note, Person. It seems to be failing because of dependencies between these domain classes. Is there a way to specify the order in which these mapping files should be processed?
The specific error message I'm getting is this:
Assembly Initialization method MyAppSample.Tests.NHibernateTestBase.Setup threw exception. NHibernate.HibernateException: NHibernate.HibernateException: There is already an object named 'Person' in the database. ---> System.Data.SqlClient.SqlException: There is already an object named 'Person' in the database.. Aborting test execution.
Stack Trace:
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script, Boolean export, Boolean format, Boolean throwOnError, TextWriter exportOutput, IDbCommand statement, String sql)
NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script, Boolean export, Boolean justDrop, Boolean format, IDbConnection connection, TextWriter exportOutput)
NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script, Boolean export, Boolean justDrop, Boolean format)
NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script, Boolean export, Boolean justDrop, Boolean format)
MyAppSample.Tests.Setup.InfrastructureSetup.BuildDatabase(DataStore datastore) in C:\TeamProjects\MyCompany.MyApp\Sandbox\MyAppSample\MyAppSample.Tests\Setup\InfrastructureSetup.cs: line 38
MyAppSample.Tests.Setup.InfrastructureSetup.SetupNHibernate() in C:\TeamProjects\MyCompany.MyApp\Sandbox\MyAppSample\MyAppSample.Tests\Setup\InfrastructureSetup.cs: line 27
MyAppSample.Tests.NHibernateTestBase.Setup(TestContext context) in C:\TeamProjects\MyCompany.MyApp\Sandbox\MyAppSample\MyAppSample.Tests\NHibernateTestBase.cs: line 25
|