简体   繁体   English

如何在每个EF迁移上运行SQL脚本

[英]How to run sql script on every EF migration

I want to run some custom Sql after every migration. 我想在每次迁移后运行一些自定义Sql。 I was hoping there was a global event or something I could tap into instead of putting my code in each individual migration. 我希望有一个全局事件或可以利用的东西,而不是将代码放入每个单独的迁移中。

What am I doing? 我在做什么? I'm going to traverse the dbcontext via reflection to find enums to dump the key/values into an 'enum' table. 我将通过反射遍历dbcontext来找到将键/值转储到“枚举”表中的枚举。 The table won't be used anywhere, it's just for reference. 该表不会在任何地方使用,仅供参考。

Thanks! 谢谢!

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

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