views:

164

answers:

1

SchemaExport seems to work, but SchemaUpdate fails - the SchemaUpdate.Exceptions contains this object:

System.NotSupportedException: The method is not supported.
in System.Data.Common.DbConnection.GetSchema(String collectionName, String[] restrictionValues)
in NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
in NHibernate.Tool.hbm2ddl.DatabaseMetadata.GetTableMetadata(String name, String schema, String catalog, Boolean isQuoted)
in NHibernate.Cfg.Configuration.GenerateSchemaUpdateScript(Dialect dialect, DatabaseMetadata databaseMetadata)
in NHibernate.Tool.hbm2ddl.SchemaUpdate.Execute(Action`1 scriptAction, Boolean doUpdate)
A: 

OK, I think it is of more interest why schema update will not work with the Compact Edition of MS SQL.

The stack trace implies that not a method of NHibernate fails, but the method for retrieving the current database schema. When using the dialect for M$ SQL CE there actually should be a call to System.Data.SqlServerCe.SqlCeConnection.GetSchema() within the stack trace. However, only DbConnection.GetSchema() appears. This means two things:

  1. Class SqlCeConnection does not override the implementation of this method, hence the implementation of the base class will be called. However, the base class does nothing more than throwing a NotSupportedException

  2. NHibernate or the dialect suitable for M$ SQL CE cannot do anything about it. So, this would be an issue to be fixed by M$

Seven