是否可以仅为模型的一部分生成迁移? [英] Is it possible to generate migration only for a part of model?
问题描述
我想使用自定义VSIX插件生成迁移,仅用于模型的一部分。我发现我可以通过overridnig方法Generate(IEnumerable operations,string @namespace,
string className)过滤从CSharpMigrationCodeGenerator继承的类中生成的代码。我在此方法中过滤了一个表的操作。我读到在修改迁移时我应该在PackageManager控制台中第二次调用Add-Migration。我做的。然后更新数据库。当我为整个
模型创建下一次迁移时,没有生成过滤表的代码,我必须自己为以前过滤的表编写代码。
我认为在迁移文件中进行更改时第二次调用Add-Migration方法将查看迁移代码并为我应用此迁移时出现的模型制作哈希值。
Pavel Bily
嗨Pavel,
欢迎来到MSDN论坛。
我试图涉及到高级专家进入你的线程。请等待回复。任何不便敬请谅解。
美好的一天。 跨度>
I would like to generate migrations using custom VSIX plugin and only for a part of model. I found out I can filter generated code in class inherited from CSharpMigrationCodeGenerator by overridnig method Generate(IEnumerable operations, string @namespace, string className). I filtered operations for one table in this method. I read that I should invoke Add-Migration for second time in PackageManager console when modifying the migration. I did it. Then updated database. When I created next migration for whole model, code for filtered table was not generated and I had to write code for previously filtered table by myself.
I thought that invoking Add-Migration method for second time when I made changes in migration file will look into migration code and make hash for model which will arise when I apply this migration.
Pavel Bily
Hi Pavel,
Welcome to the MSDN forum.
I am trying to involve a senior expert into your thread. Please wait for the response. Sorry for any inconvenience.
Good day.
这篇关于是否可以仅为模型的一部分生成迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!