问题
Is it poosible to add default data to my SchemaExport. If not what's best way to do that? I would like to have one *.sql file with creation script for "tables" and "default data", or is there a better way?
回答1:
I just have a little console application which calls SchemaExport and then creates default entities and calls Session.Save() on them.
all I have to do to is configure the connection string on that app and run it, and.. voila!
actually no .sql files needed at all, which I like.
回答2:
I have created the schema then had to run another script to insert test data.
As another option you may want to look at these two data builder projects which allow you to create N number of entities which you could then persist.
- Plant
- NBuilder
来源:https://stackoverflow.com/questions/6571075/default-data-for-installation