Default data for installation

荒凉一梦 提交于 2019-12-22 08:52:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!