简体   繁体   English

我可以在不更改模型的情况下触发重新种子吗?

[英]Can I trigger a re-seed without a model change?

My database initializer extends DropCreateDatabaseIfModelChanges . 我的数据库初始化程序扩展了DropCreateDatabaseIfModelChanges This is generally how I want my app setup. 通常,这就是我想要设置我的应用程序的方式。 However, occasionally I muck things up bad enough that I would like to go ahead and trigger drop and reseed, even though my model has not changed. 但是,即使我的模型没有更改, 偶尔也会把事情搞得糟透了,以至于我想继续触发并下降并重新设置种子。 Is this possible? 这可能吗?

Extend from DropCreateDatabaseAlways DropCreateDatabaseAlways扩展

It will always drop, re-create and seed the database. 它将始终删除,重新创建和播种数据库。

An implementation of IDatabaseInitializer that will always recreate and optionally re-seed the database the first time that a context is used in the app domain. IDatabaseInitializer的实现,将始终在应用程序域中首次使用上下文时重新创建数据库并有选择地重新种子化数据库。 To seed the database, create a derived class and override the Seed method. 要为数据库设置种子,请创建一个派生类并覆盖Seed方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM