简体   繁体   English

FluentMigrator中迁移类的代码生成模板

[英]Code Generation Templates of Migration Classes in FluentMigrator

Are there any code generation templates available for use with FluentMigrator to generate migration classes from SQL (T-SQL) statements?是否有任何代码生成模板可用于 FluentMigrator 以从 SQL (T-SQL) 语句生成迁移类?

Ideally I would like to take text that contains statements for creating tables, indexes, etc and generate a migration class with the Up and Down methods containing the equivalent of the original SQL statements.理想情况下,我想获取包含用于创建表、索引等的语句的文本,并使用包含原始 SQL 语句的 Up 和 Down 方法生成迁移 class 。

I'm only concerned with solutions based on open source or free code generation tools.我只关心基于开源或免费代码生成工具的解决方案。

I wrote an application that will read an existing database and then generate a FluentMigrator Migration Class with both Up and Down methods.我编写了一个应用程序,它将读取现有数据库,然后使用 Up 和 Down 方法生成 FluentMigrator Migration Class。

http://pfsolutions-mi.com/Product/FluentMigratorClassGenerator http://pfsolutions-mi.com/Product/FluentMigratorClassGenerator

Have a look at Guru Kathiresan's T4 Template for creating FM initial schemas .查看 Guru Kathiresan 的用于创建 FM 初始模式的 T4 模板 This link came from the FluentMigrator Google Group .此链接来自FluentMigrator Google Group

No, nothing like this exists as far as I know.不,据我所知,没有这样的东西存在。 The closest thing is the ability to write your own schema dump code.最接近的是编写自己的模式转储代码的能力。 That could be used to take an existing database and generate FluentMigrator syntax from it.这可用于获取现有数据库并从中生成 FluentMigrator 语法。 Here is a sample of how one might do that. 是一个如何做到这一点的示例。

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

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