0

I got all C# implementations on Google, so I converted it to VB.Net, but I am not able to convert 1 line where it gives error.

My Class :

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

Once again :

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

I read in an article that its mandatory for version of Migration, otherwise Migratordotnet will miss the migration.

So.. How to do it ?

4

1 回答 1

4

Like this:

<Migration(1)> _
Public Class mig_001

This <…&gt; feature, belonging to the following class, is called an attribute in .NET.

于 2011-07-19T16:36:24.947 回答