Migratordotnet:如何用VB.net编写迁移类?

时间:2011-07-19 16:34:54

标签: vb.net migration migratordotnet

我在Google上获得了所有C#实现,因此我将其转换为VB.Net,但我无法将1行转换为错误。

我的班级:

Imports Migrator.Framework

[Migration(1)]     ' Gives ERROR Here.. How to write this in VB.net ?

Public Class mig_001
    Inherits Migration

    Public Overrides Sub Up()
        Database.AddTable("Planets",
            New Column("Id", DbType.Int32, ColumnProperty.PrimaryKeyWithIdentity),
            New Column("Name", DbType.String, 100, ColumnProperty.NotNull),
            New Column("Diameter", DbType.Double),
            New Column("Mass", DbType.Double),
            New Column("SupportsLife", DbType.Boolean, False)
        )
    End Sub

    Public Overrides Sub Down()
        Database.RemoveTable("Planets")
    End Sub
End Class

再次:

[Migration(1)] => How to write this in VB.net and what does it means in VB.net ?

我在一篇文章中读到它对迁移版本是强制性的,否则Migratordotnet将错过迁移。

那么..怎么做?

1 个答案:

答案 0 :(得分:4)

像这样:

<Migration(1)> _
Public Class mig_001

<…>功能属于以下类,在.NET中称为属性