开发者

How to Ensure Fluent NHibernate Mappings and Migrations are in sync?

I use Migrator Dot Net to version my database schema, and Fluent NHibernate to Map models to the schema.

Is there a good (read: automated) 开发者_如何学Goway to compare the schema generated by running migrations with the schema generated by the NH schema export to ensure that table definitions, keys, indices etc are in sync?

The only thing I can think of would be to export both schemas, then use some unknown (answer if you know a good one!) library to script them out, then compare script strings.

Is there a better way?

Edit: To Clarify, I would like to verify not only tables, columns, and column types, but also indices and foreign keys.


There is a schema validator in NHibernate:

SchemaValidator validator = new SchemaValidator(configuration);
validator.Validate();


I think that it would suffice to check that the mappings generated by FNH and your DB schema are in sync.
for that you can use this simple test

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜